other_video_transcoding 0.3.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -0
- data/README.md +2 -2
- data/bin/ask-ffmpeg-log +5 -5
- data/bin/other-transcode +279 -186
- data/other_video_transcoding-0.1.0.gem +0 -0
- data/other_video_transcoding-0.1.1.gem +0 -0
- data/other_video_transcoding-0.2.0.gem +0 -0
- data/other_video_transcoding-0.3.0.gem +0 -0
- data/other_video_transcoding-0.3.1.gem +0 -0
- data/other_video_transcoding-0.3.2.gem +0 -0
- data/other_video_transcoding-0.4.0.gem +0 -0
- data/other_video_transcoding-0.5.0.gem +0 -0
- data/other_video_transcoding.gemspec +1 -1
- metadata +13 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e35c9d638ce45ae7407b8a3d88f0a785b515683c30e55b2d325e3cc243c15431
|
4
|
+
data.tar.gz: ae7a7405f0b57be44ee16dfc6b48c877730b4b6cd6933410a6ec3828bea124ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15c29bac8aa3f7cb7ba9dcf6cf5c22e2c99f3b8ab8a709652166c885c5e2207873abdd2319c86cc5745aac977bab6911e50407356caa730976af465a88089dcb
|
7
|
+
data.tar.gz: 56d94453fda02a51ac29ddbdc904192874712f4ea3457a647383c2628bd54ebe636447771940e80ee6335a74e16ccef0fd14d6785e9a2998a22acf7b12c2f027
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,57 @@
|
|
2
2
|
|
3
3
|
This single document contains all of the notes created for each [release](https://github.com/donmelton/other_video_transcoding/releases).
|
4
4
|
|
5
|
+
## [0.6.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.6.0)
|
6
|
+
|
7
|
+
Tuesday, December 22, 2020
|
8
|
+
|
9
|
+
* Lower the default target bitrates for 8-bit HEVC video in `other-transcode` to match the defaults for 10-bit HEVC video. This means, for example, the default target for HEVC at a 1080p resolution will be 6000 Kbps no matter the output bit depth.
|
10
|
+
* Modify `other-transcode` to set the video buffer size equal to the maximum video bitrate when using an Nvidia encoder, essentially adding `--rc-bufsize 3` to the command line. Previously the buffer size was never explicitly set so `ffmpeg` would use a default value of twice the target bitrate. Since the maximum bitrate is normally three times the target bitrate this meant the buffer size was actually smaller than the maximum. While this didn't cause any known problems, Nvidia recommends a larger buffer size to improve quality. However, using `--rc-bufsize 0` will restore the old behavior and the default value from `ffmpeg`.
|
11
|
+
* Ignore the `--nvenc-lookahead` option in `other-transcode` when the argument is `0` since such a value won't change the behavior of an Nvidia encoder anyway.
|
12
|
+
* Add a `--limit-ac3-surround` option to `other-transcode` which prevents surround audio in AC-3 or Dolby Digital Plus (Enhanced AC-3) format from being copied instead of transcoded when the orginal bitrate is above the transcoding bitrate. This allows setting a lower target with the `--surround-bitrate` option in order to force higher-bitrate tracks to be transcoded instead of copied.
|
13
|
+
* Reduce the minimum bitrates for Dolby Digital Plus audio in `other-transcode` from 256, 128 and 64 Kbps for surround, stereo and mono layouts to 192, 96 and 48 Kbps. The default bitrates for Dolby Digital Plus audio remain the same and this change does not affect audio output in AC-3 or AAC formats.
|
14
|
+
|
15
|
+
## [0.5.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.5.0)
|
16
|
+
|
17
|
+
Tuesday, November 24, 2020
|
18
|
+
|
19
|
+
* Add `--qsv-decoder` and `--qsv-device` options to `other-transcode`, both of which enable the scoped use of the Intel Quick Sync Video (QSV) decoder instead of the generic hardware decoder. These options can significantly speed operation of the QSV encoder, invoked via `--qsv`. It's recommended that `--decode all` be included when using these options to decode all video input formats. The `--qsv-device` option allows selection of specific hardware by number or path depending on platform. Please note that deinterlacing, cropping, scaling or using other filters will disable QSV's format-specific decoders.
|
20
|
+
* Remove all deprecated options and arguments from `other-transcode`.
|
21
|
+
|
22
|
+
## [0.4.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.4.0)
|
23
|
+
|
24
|
+
Sunday, November 1, 2020
|
25
|
+
|
26
|
+
* Modify the behavior and augment the capabilities of both encoding and decoding when using Nvidia hardware with `other-transcode`. This is necessary for compatibility with unleased versions of `ffmpeg` which are now built using the new Nvidia Software Development Kit (SDK) version 11.0. This SDK changes default encoder behavior and adds new presets which allow finer control of the performance/quality trade-off when transcoding video. To allow maximum performance, `other-transcode` no longer enables some quality settings by default:
|
27
|
+
* Multipass mode, now accessible via a new `--nvenc-multipass` option. Be advised that any improved quality from enabling multipass mode is probably not worth the performance impact.
|
28
|
+
* Spatial and temporal adaptive quantization (AQ), accessible via the `--nvenc-spatial-aq` and `--nvenc-temporal-aq` options. While enabling spatial AQ is still useful in reducing color banding for some inputs, be advised that enabling temporal AQ is probably not necessary and can cause some other side effects.
|
29
|
+
* Add support for seven new Nvidia encoder presets to `other-transcode`. Use `--preset p1` for best performance and `--preset p7` for best quality. It's not necessary to use `--preset p4` since that's the default. See the [Nvidia preset migration guide](https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/index.html) to understand how these presets work and how they map to older behavior.
|
30
|
+
* Add a `--nvenc-rc-mode` option to `other-transcode` for backward comaptibility with `ffmpeg` version 4.3.1 and older.
|
31
|
+
* Add `--cuda` and `--no-cuda` options to `other-transcode`. These options enable or disable the scoped use of the Nvidia CUDA hardware decoder instead of the generic hardware decoder. By default the CUDA _decoder_ is enabled when using the Nvidia video _encoder_, but disabled when using other encoders.
|
32
|
+
* Deprecate the `--cuvid` option in `other-transcode` because the CUDA decoder is faster and more flexible.
|
33
|
+
* Deprecate `--preset none` in `other-transcode` because it's no longer necessary.
|
34
|
+
* Always use hyphen-based spellings of Nvidia AQ options in `ffmpeg` commands generated by `other-transcode`.
|
35
|
+
* Add `--x264-params` and `--x265-params` options to `other-transcode` for _very_ advanced manipulation of the `x264` and `x265` software encoders.
|
36
|
+
* Modify `other-transcode` to assume a video input without a `field_order` tag is progressive instead of interlaced so a deinterlace fliter is not automatically and incorrectly applied to that video. This avoids problems with some 4K Ultra HD Blu-ray rips.
|
37
|
+
* Update the link to Docker containers for Linux in the "README" document. Thanks, @ttyS0!
|
38
|
+
|
39
|
+
## [0.3.2](https://github.com/donmelton/other_video_transcoding/releases/tag/0.3.2)
|
40
|
+
|
41
|
+
Friday, September 11, 2020
|
42
|
+
|
43
|
+
* Modify `other-transcode` to use a new `ffmpeg` Matroksa muxer option so the `-disposition` option is once again honored when using `ffmpeg` version 4.3 and later.
|
44
|
+
* Change the codec ID from the default of `hev1` to `hvc1` for HEVC video in MP4 output from `other-transcode` to enable playback in QuickTime on macOS. Via [ #50](https://github.com/donmelton/other_video_transcoding/issues/50).
|
45
|
+
* Convert added SRT format subtitles to MOV-compatible format in MP4 output from `other-transcode`. Via [ #55](https://github.com/donmelton/other_video_transcoding/issues/55).
|
46
|
+
|
47
|
+
## [0.3.1](https://github.com/donmelton/other_video_transcoding/releases/tag/0.3.1)
|
48
|
+
|
49
|
+
Tuesday, May 26, 2020
|
50
|
+
|
51
|
+
* Modify the `--preview-crop` option in `other-transcode` to show commands compatible with newer versions of `mpv`.
|
52
|
+
* No longer force a NTSC film frame rate for interlaced inputs in PAL MPEG-2 format.
|
53
|
+
* When using the `--dry-run` option in `other-transcode`, issue a warning instead of failing if the output or log files already exist.
|
54
|
+
* Add a link to another Docker container for Linux in the "README" document. Thanks, @ttyS0!
|
55
|
+
|
5
56
|
## [0.3.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.3.0)
|
6
57
|
|
7
58
|
Thursday, February 27, 2020
|
data/README.md
CHANGED
@@ -62,9 +62,9 @@ See "[Download FFmpeg](https://ffmpeg.org/download.html)," "[MKVToolNix Download
|
|
62
62
|
|
63
63
|
Additional documentation for installing these programs on Windows is available in the [wiki](https://github.com/donmelton/other_video_transcoding/wiki/Windows).
|
64
64
|
|
65
|
-
|
65
|
+
[Docker](https://en.wikipedia.org/wiki/Docker_(software)) containers for Linux, including installation instructions, are available here:
|
66
66
|
|
67
|
-
https://github.com/ttyS0/docker-transcode
|
67
|
+
https://github.com/ttyS0/docker-other-transcode
|
68
68
|
|
69
69
|
On macOS, all of these programs can be easily installed via [Homebrew](http://brew.sh/), an optional package manager:
|
70
70
|
|
data/bin/ask-ffmpeg-log
CHANGED
@@ -15,14 +15,14 @@ module Transcoding
|
|
15
15
|
|
16
16
|
class Command
|
17
17
|
def about
|
18
|
-
|
19
|
-
ask-ffmpeg-log 0.
|
18
|
+
<<-HERE
|
19
|
+
ask-ffmpeg-log 0.6.0
|
20
20
|
Copyright (c) 2019-2020 Don Melton
|
21
|
-
HERE
|
21
|
+
HERE
|
22
22
|
end
|
23
23
|
|
24
24
|
def usage
|
25
|
-
|
25
|
+
<<-HERE
|
26
26
|
Report temporal information from ffmpeg-generated `.log` files
|
27
27
|
containing encoding statistics.
|
28
28
|
|
@@ -34,7 +34,7 @@ Options:
|
|
34
34
|
--tabular use tab character as field delimiter and suppress labels
|
35
35
|
-h, --help display this help and exit
|
36
36
|
--version output version information and exit
|
37
|
-
HERE
|
37
|
+
HERE
|
38
38
|
end
|
39
39
|
|
40
40
|
def initialize
|
data/bin/other-transcode
CHANGED
@@ -17,14 +17,14 @@ module Transcoding
|
|
17
17
|
|
18
18
|
class Command
|
19
19
|
def about
|
20
|
-
|
21
|
-
other-transcode 0.
|
20
|
+
<<-HERE
|
21
|
+
other-transcode 0.6.0
|
22
22
|
Copyright (c) 2019-2020 Don Melton
|
23
|
-
HERE
|
23
|
+
HERE
|
24
24
|
end
|
25
25
|
|
26
26
|
def usage1
|
27
|
-
|
27
|
+
<<-HERE
|
28
28
|
Transcode Blu-ray Disc or DVD rip into a smaller, more portable format
|
29
29
|
while remaining high enough quality to be mistaken for the original.
|
30
30
|
|
@@ -34,55 +34,55 @@ Creates Matroska `.mkv` format file in current working directory.
|
|
34
34
|
|
35
35
|
Automatically selects a platform-specific hardware video encoder.
|
36
36
|
|
37
|
-
HERE
|
37
|
+
HERE
|
38
38
|
end
|
39
39
|
|
40
40
|
def usage2
|
41
|
-
|
41
|
+
<<-HERE
|
42
42
|
Input options:
|
43
43
|
--position TIME, --duration TIME
|
44
44
|
start transcoding at position and/or limit to duration
|
45
45
|
in seconds[.milliseconds] or [HH:]MM:SS[.m...] format
|
46
46
|
|
47
|
-
HERE
|
47
|
+
HERE
|
48
48
|
end
|
49
49
|
|
50
50
|
def usage3
|
51
|
-
|
51
|
+
<<-HERE
|
52
52
|
Output options:
|
53
53
|
--debug increase diagnostic information
|
54
54
|
--scan print media information and exit
|
55
55
|
--preview-crop show commands to preview detected video crop and exit
|
56
|
-
HERE
|
56
|
+
HERE
|
57
57
|
end
|
58
58
|
|
59
59
|
def usage4
|
60
|
-
|
60
|
+
<<-HERE
|
61
61
|
--print-crop print only detected video crop geometry and exit
|
62
62
|
--mp4 output MP4 instead of Matroska `.mkv` format
|
63
63
|
--copy-track-names
|
64
64
|
copy all input audio track names to output
|
65
|
-
HERE
|
65
|
+
HERE
|
66
66
|
end
|
67
67
|
|
68
68
|
def usage5
|
69
|
-
|
69
|
+
<<-HERE
|
70
70
|
--max-muxing-queue-size SIZE
|
71
71
|
set maximum number of packets to buffer when muxing
|
72
|
-
HERE
|
72
|
+
HERE
|
73
73
|
end
|
74
74
|
|
75
75
|
def usage6
|
76
|
-
|
76
|
+
<<-HERE
|
77
77
|
-n, --dry-run don't transcode, just show `ffmpeg` command and exit
|
78
78
|
|
79
79
|
Video options:
|
80
80
|
--hevc use HEVC version of platform-specific video encoder
|
81
|
-
HERE
|
81
|
+
HERE
|
82
82
|
end
|
83
83
|
|
84
84
|
def usage7
|
85
|
-
|
85
|
+
<<-HERE
|
86
86
|
--vt use Apple Video Toolbox encoder
|
87
87
|
--nvenc use Nvidia video encoder
|
88
88
|
--qsv use Intel Quick Sync video encoder
|
@@ -93,19 +93,24 @@ HERE
|
|
93
93
|
--10-bit, --no-10-bit
|
94
94
|
use 10-bit pixel format (default: not used for H.264,
|
95
95
|
used for HEVC with Nvidia, Intel and x265 encoders)
|
96
|
-
--preset NAME
|
97
|
-
apply video encoder preset or disable default settings
|
96
|
+
--preset NAME apply video encoder preset
|
98
97
|
--decode vc1|all|none
|
99
98
|
set scope of automatic hardware decoder acceleration
|
100
99
|
(default: vc1 for VC-1 format only)
|
101
|
-
--
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
--cuda, --no-cuda
|
101
|
+
enable or disable scoped use of Nvidia video decoder
|
102
|
+
instead of generic hardware decoder
|
103
|
+
(default: enabled when using Nvidia video encoder,
|
104
|
+
disabled when using other encoders)
|
105
|
+
--qsv-decoder enable scoped use of Intel Quick Sync video decoder
|
106
|
+
instead of generic hardware decoder
|
107
|
+
--qsv-device DEVICE
|
108
|
+
enable scoped use of QSV decoder for specific device
|
109
|
+
HERE
|
105
110
|
end
|
106
111
|
|
107
112
|
def usage8
|
108
|
-
|
113
|
+
<<-HERE
|
109
114
|
--target [2160p=|1080p=|720p=|480p=]BITRATE
|
110
115
|
set video bitrate target (default: based on input)
|
111
116
|
or target for specific input resolution
|
@@ -113,11 +118,11 @@ HERE
|
|
113
118
|
set video crop geometry (default: none)
|
114
119
|
or automatically detect it
|
115
120
|
--720p fit video within 1280x720 pixel bounds
|
116
|
-
HERE
|
121
|
+
HERE
|
117
122
|
end
|
118
123
|
|
119
124
|
def usage9
|
120
|
-
|
125
|
+
<<-HERE
|
121
126
|
--1080p " " " 1920x1080 " "
|
122
127
|
--deinterlace reduce interlace artifacts without changing frame rate
|
123
128
|
(applied automatically for some inputs)
|
@@ -126,11 +131,11 @@ HERE
|
|
126
131
|
--detelecine drop duplicate frames to restore original frame rate
|
127
132
|
(disables any deinterlacing and forced frame rate)
|
128
133
|
--no-filters disable any automatic adjustments via filters
|
129
|
-
HERE
|
134
|
+
HERE
|
130
135
|
end
|
131
136
|
|
132
137
|
def usage10
|
133
|
-
|
138
|
+
<<-HERE
|
134
139
|
--rc-maxrate FACTOR, --rc-bufsize FACTOR
|
135
140
|
set ratecontrol maximum rate and/or buffer size
|
136
141
|
as multiple of video bitrate target
|
@@ -140,17 +145,20 @@ Apple Video Toolbox encoder options:
|
|
140
145
|
--vt-allow-sw allow software encoding
|
141
146
|
|
142
147
|
Nvidia video encoder options:
|
143
|
-
--nvenc-spatial-aq
|
144
|
-
enable
|
145
|
-
--nvenc-temporal-aq
|
146
|
-
enable
|
147
|
-
(default: enabled for H.264, disabled for HEVC)
|
148
|
+
--nvenc-spatial-aq
|
149
|
+
enable spatial adaptive quantization (AQ)
|
150
|
+
--nvenc-temporal-aq
|
151
|
+
enable temporal adaptive quantization (AQ)
|
148
152
|
--nvenc-lookahead FRAMES
|
149
153
|
set number of frames to look ahead for ratecontrol
|
154
|
+
--nvenc-multipass qres|fullres
|
155
|
+
set multipass encoding resolution
|
150
156
|
--nvenc-refs FRAMES
|
151
157
|
set number of reference frames
|
152
158
|
--nvenc-bframes FRAMES
|
153
159
|
set maximum number of B-frames
|
160
|
+
--nvenc-rc-mode vbr|vbr_hq
|
161
|
+
set ratecontrol mode (default: vbr)
|
154
162
|
|
155
163
|
Intel Quick Sync video encoder options:
|
156
164
|
--qsv-refs FRAMES
|
@@ -179,27 +187,33 @@ x264 software video encoder options:
|
|
179
187
|
--x264-quick increase encoding speed by 70-80%
|
180
188
|
with no easily perceptible loss in video quality
|
181
189
|
(avoids quality problems with some encoder presets)
|
182
|
-
|
190
|
+
--x264-params KEY=VALUE[:KEY=VALUE]...
|
191
|
+
override x264 configuration (disables other x264 options)
|
192
|
+
|
193
|
+
x265 software video encoder options:
|
194
|
+
--x265-params KEY=VALUE[:KEY=VALUE]...
|
195
|
+
override x265 configuration
|
196
|
+
HERE
|
183
197
|
end
|
184
198
|
|
185
199
|
def usage11
|
186
|
-
|
200
|
+
<<-HERE
|
187
201
|
|
188
202
|
Audio options:
|
189
203
|
--main-audio TRACK[=WIDTH]
|
190
204
|
select main audio track by number (default: 1)
|
191
205
|
with optional width (default: surround)
|
192
|
-
HERE
|
206
|
+
HERE
|
193
207
|
end
|
194
208
|
|
195
209
|
def usage12
|
196
|
-
|
210
|
+
<<-HERE
|
197
211
|
(use `original` to disable transcoding)
|
198
|
-
HERE
|
212
|
+
HERE
|
199
213
|
end
|
200
214
|
|
201
215
|
def usage13
|
202
|
-
|
216
|
+
<<-HERE
|
203
217
|
--add-audio TRACK|all|LANGUAGE|STRING[=WIDTH]
|
204
218
|
add single audio track by number
|
205
219
|
including main audio track
|
@@ -212,49 +226,52 @@ HERE
|
|
212
226
|
excluding main audio track
|
213
227
|
(comparison is case-insensitve)
|
214
228
|
with optional width (default: stereo)
|
215
|
-
HERE
|
229
|
+
HERE
|
216
230
|
end
|
217
231
|
|
218
232
|
def usage14
|
219
|
-
|
233
|
+
<<-HERE
|
220
234
|
(use `original` to disable transcoding)
|
221
|
-
HERE
|
235
|
+
HERE
|
222
236
|
end
|
223
237
|
|
224
238
|
def usage15
|
225
|
-
|
239
|
+
<<-HERE
|
226
240
|
--surround-bitrate BITRATE
|
227
241
|
set surround audio bitrate (default: 640)
|
228
242
|
--stereo-bitrate BITRATE
|
229
243
|
set stereo audio bitrate (default: 256)
|
230
|
-
HERE
|
244
|
+
HERE
|
231
245
|
end
|
232
246
|
|
233
247
|
def usage16
|
234
|
-
|
248
|
+
<<-HERE
|
235
249
|
--mono-bitrate BITRATE
|
236
250
|
set mono audio bitrate (default: 50% of stereo bitrate)
|
237
|
-
HERE
|
251
|
+
HERE
|
238
252
|
end
|
239
253
|
|
240
254
|
def usage17
|
241
|
-
|
255
|
+
<<-HERE
|
242
256
|
--eac3 use Enhanced AC-3 format for surround audio
|
243
|
-
HERE
|
257
|
+
HERE
|
244
258
|
end
|
245
259
|
|
246
260
|
def usage18
|
247
|
-
|
261
|
+
<<-HERE
|
248
262
|
--all-eac3 " " " " " all audio
|
263
|
+
--limit-ac3-surround
|
264
|
+
don't copy surround audio in AC-3 format
|
265
|
+
when orginal bitrate is above transcoding bitrate
|
249
266
|
--keep-ac3-stereo
|
250
267
|
copy stereo and mono audio in AC-3 format
|
251
268
|
even when orginal bitrate is above transcoding bitrate
|
252
269
|
--pass-dts enable passthrough of audio in DTS and DTS-ES formats
|
253
|
-
HERE
|
270
|
+
HERE
|
254
271
|
end
|
255
272
|
|
256
273
|
def usage19
|
257
|
-
|
274
|
+
<<-HERE
|
258
275
|
|
259
276
|
Subtitle options:
|
260
277
|
--add-subtitle TRACK[=forced]|auto|all|LANGUAGE|STRING
|
@@ -279,7 +296,7 @@ Other options:
|
|
279
296
|
--version output version information and exit
|
280
297
|
|
281
298
|
Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
|
282
|
-
HERE
|
299
|
+
HERE
|
283
300
|
end
|
284
301
|
|
285
302
|
def initialize
|
@@ -290,6 +307,7 @@ HERE
|
|
290
307
|
@detect = false
|
291
308
|
@preview = false
|
292
309
|
@format = :mkv
|
310
|
+
@mkv_options = []
|
293
311
|
@copy_track_names = false
|
294
312
|
@max_muxing_queue_size = nil
|
295
313
|
@dry_run = false
|
@@ -298,7 +316,8 @@ HERE
|
|
298
316
|
@ten_bit = nil
|
299
317
|
@preset = nil
|
300
318
|
@decode_scope = :vc1
|
301
|
-
@
|
319
|
+
@decode_method = nil
|
320
|
+
@qsv_device = nil
|
302
321
|
@target_2160p = nil
|
303
322
|
@target_1080p = nil
|
304
323
|
@target_720p = nil
|
@@ -314,11 +333,13 @@ HERE
|
|
314
333
|
@maxrate = nil
|
315
334
|
@bufsize = nil
|
316
335
|
@vt_allow_sw = false
|
317
|
-
@nvenc_spatial_aq =
|
318
|
-
@nvenc_temporal_aq =
|
336
|
+
@nvenc_spatial_aq = false
|
337
|
+
@nvenc_temporal_aq = false
|
319
338
|
@nvenc_lookahead = nil
|
339
|
+
@nvenc_multipass = nil
|
320
340
|
@nvenc_refs = nil
|
321
341
|
@nvenc_bframes = nil
|
342
|
+
@nvenc_rc_mode = 'vbr'
|
322
343
|
@qsv_refs = nil
|
323
344
|
@qsv_bframes = nil
|
324
345
|
@amf_quality = nil
|
@@ -330,6 +351,8 @@ HERE
|
|
330
351
|
@x264_avbr = false
|
331
352
|
@x264_mbtree = false
|
332
353
|
@x264_quick = false
|
354
|
+
@x264_params = nil
|
355
|
+
@x265_params = nil
|
333
356
|
@audio_selections = [{
|
334
357
|
:track => 1,
|
335
358
|
:language => nil,
|
@@ -341,6 +364,7 @@ HERE
|
|
341
364
|
@mono_bitrate = nil
|
342
365
|
@surround_encoder = 'ac3'
|
343
366
|
@stereo_encoder = nil
|
367
|
+
@keep_ac3_surround = true
|
344
368
|
@keep_ac3_stereo = false
|
345
369
|
@pass_dts = false
|
346
370
|
@subtitle_selections = []
|
@@ -495,8 +519,17 @@ HERE
|
|
495
519
|
end
|
496
520
|
end
|
497
521
|
|
498
|
-
opts.on '--
|
499
|
-
@
|
522
|
+
opts.on '--[no-]cuda' do |arg|
|
523
|
+
@decode_method = arg ? 'cuda' : 'auto'
|
524
|
+
end
|
525
|
+
|
526
|
+
opts.on '--qsv-decoder' do
|
527
|
+
@decode_method = 'qsv'
|
528
|
+
end
|
529
|
+
|
530
|
+
opts.on '--qsv-device ARG' do |arg|
|
531
|
+
@qsv_device = arg
|
532
|
+
@decode_method = 'qsv'
|
500
533
|
end
|
501
534
|
|
502
535
|
opts.on '--target ARG' do |arg|
|
@@ -553,7 +586,7 @@ HERE
|
|
553
586
|
@deinterlace = true
|
554
587
|
@detelecine = false
|
555
588
|
@enable_filters = false
|
556
|
-
@encoder = nil if @encoder == 'copy'
|
589
|
+
@encoder = nil if @encoder == 'copy'
|
557
590
|
end
|
558
591
|
|
559
592
|
opts.on '--rate ARG' do |arg|
|
@@ -619,19 +652,35 @@ HERE
|
|
619
652
|
@vt_allow_sw = true
|
620
653
|
end
|
621
654
|
|
622
|
-
opts.on '--
|
655
|
+
opts.on '--nvenc-spatial-aq' do
|
623
656
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
624
|
-
@nvenc_spatial_aq =
|
657
|
+
@nvenc_spatial_aq = true
|
625
658
|
end
|
626
659
|
|
627
|
-
opts.on '--
|
660
|
+
opts.on '--nvenc-temporal-aq' do
|
628
661
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
629
|
-
@nvenc_temporal_aq =
|
662
|
+
@nvenc_temporal_aq = true
|
630
663
|
end
|
631
664
|
|
632
665
|
opts.on '--nvenc-lookahead ARG', Integer do |arg|
|
633
666
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
634
|
-
|
667
|
+
|
668
|
+
if arg > 0
|
669
|
+
@nvenc_lookahead = [arg, 32].min
|
670
|
+
else
|
671
|
+
@nvenc_lookahead = nil
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
opts.on '--nvenc-multipass ARG' do |arg|
|
676
|
+
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
677
|
+
|
678
|
+
@nvenc_multipass = case arg
|
679
|
+
when 'qres', 'fullres'
|
680
|
+
arg
|
681
|
+
else
|
682
|
+
fail UsageError, "invalid multipass resolution argument: #{arg}"
|
683
|
+
end
|
635
684
|
end
|
636
685
|
|
637
686
|
opts.on '--nvenc-refs ARG', Integer do |arg|
|
@@ -644,6 +693,17 @@ HERE
|
|
644
693
|
@nvenc_bframes = [[arg, 0].max, 4].min
|
645
694
|
end
|
646
695
|
|
696
|
+
opts.on '--nvenc-rc-mode ARG' do |arg|
|
697
|
+
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
698
|
+
|
699
|
+
@nvenc_rc_mode = case arg
|
700
|
+
when 'vbr', 'vbr_hq'
|
701
|
+
arg
|
702
|
+
else
|
703
|
+
fail UsageError, "invalid rate control argument: #{arg}"
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
647
707
|
opts.on '--qsv-refs ARG', Integer do |arg|
|
648
708
|
@encoder = @hevc ? 'hevc_qsv' : 'h264_qsv'
|
649
709
|
@qsv_refs = [arg, 0].max
|
@@ -695,6 +755,7 @@ HERE
|
|
695
755
|
@hevc = false
|
696
756
|
@x264_avbr = true
|
697
757
|
@x264_mbtree = false
|
758
|
+
@x264_params = nil
|
698
759
|
end
|
699
760
|
|
700
761
|
opts.on '--x264-mbtree' do
|
@@ -702,15 +763,40 @@ HERE
|
|
702
763
|
@hevc = false
|
703
764
|
@x264_mbtree = true
|
704
765
|
@x264_avbr = false
|
766
|
+
@x264_params = nil
|
705
767
|
end
|
706
768
|
|
707
769
|
opts.on '--x264-quick' do
|
708
770
|
@encoder = 'libx264'
|
709
771
|
@hevc = false
|
710
772
|
@x264_quick = true
|
773
|
+
@x264_params = nil
|
711
774
|
@preset = nil
|
712
775
|
end
|
713
776
|
|
777
|
+
opts.on '--x264-params ARG' do |arg|
|
778
|
+
arg.split ':' do |param|
|
779
|
+
fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,]+$/
|
780
|
+
end
|
781
|
+
|
782
|
+
@encoder = 'libx264'
|
783
|
+
@hevc = false
|
784
|
+
@x264_params = arg
|
785
|
+
@x264_avbr = false
|
786
|
+
@x264_mbtree = true
|
787
|
+
@x264_quick = false
|
788
|
+
end
|
789
|
+
|
790
|
+
opts.on '--x265-params ARG' do |arg|
|
791
|
+
arg.split ':' do |param|
|
792
|
+
fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,]+$/
|
793
|
+
end
|
794
|
+
|
795
|
+
@encoder = 'libx265'
|
796
|
+
@hevc = true
|
797
|
+
@x265_params = arg
|
798
|
+
end
|
799
|
+
|
714
800
|
opts.on '--main-audio ARG' do |arg|
|
715
801
|
if arg =~ /^([0-9]+)(?:=(stereo|surround|original))?$/
|
716
802
|
@audio_selections[0][:track] = $1.to_i
|
@@ -769,6 +855,10 @@ HERE
|
|
769
855
|
@stereo_encoder = 'eac3'
|
770
856
|
end
|
771
857
|
|
858
|
+
opts.on '--limit-ac3-surround' do
|
859
|
+
@keep_ac3_surround = false
|
860
|
+
end
|
861
|
+
|
772
862
|
opts.on '--keep-ac3-stereo' do
|
773
863
|
@keep_ac3_stereo = true
|
774
864
|
end
|
@@ -827,13 +917,14 @@ HERE
|
|
827
917
|
def configure(path)
|
828
918
|
@audio_selections.uniq!
|
829
919
|
@subtitle_selections.uniq!
|
830
|
-
|
831
|
-
@
|
920
|
+
min_bitrate = @surround_encoder == 'eac3' ? 192 : 256
|
921
|
+
@surround_bitrate = [[@surround_bitrate, min_bitrate].max, (@surround_encoder == 'ac3' ? 640 : 768)].min
|
922
|
+
@stereo_bitrate = [[@stereo_bitrate, min_bitrate / 2].max, (@stereo_encoder == 'eac3' ? 768 : 320)].min
|
832
923
|
|
833
924
|
if @mono_bitrate.nil?
|
834
925
|
@mono_bitrate = @stereo_bitrate / 2
|
835
926
|
else
|
836
|
-
@mono_bitrate = [[@mono_bitrate,
|
927
|
+
@mono_bitrate = [[@mono_bitrate, min_bitrate / 4].max, (@stereo_encoder == 'eac3' ? 768 : 256)].min
|
837
928
|
end
|
838
929
|
|
839
930
|
[
|
@@ -875,10 +966,11 @@ HERE
|
|
875
966
|
end
|
876
967
|
|
877
968
|
@ten_bit = (@hevc and @encoder =~ /(nvenc|qsv|x265)$/ ? true : false) if @ten_bit.nil?
|
878
|
-
@target_2160p ||=
|
879
|
-
@target_1080p ||=
|
880
|
-
@target_720p ||=
|
881
|
-
@target_480p ||=
|
969
|
+
@target_2160p ||= @hevc ? 12000 : 16000
|
970
|
+
@target_1080p ||= @hevc ? 6000 : 8000
|
971
|
+
@target_720p ||= @hevc ? 3000 : 4000
|
972
|
+
@target_480p ||= @hevc ? 1500 : 2000
|
973
|
+
@decode_method ||= @encoder =~ /nvenc$/ ? 'cuda' : 'auto'
|
882
974
|
|
883
975
|
if @stereo_encoder.nil?
|
884
976
|
if encoders =~ /aac_at/ or encoders =~ /libfdk_aac/
|
@@ -887,6 +979,11 @@ HERE
|
|
887
979
|
@stereo_encoder = 'aac'
|
888
980
|
end
|
889
981
|
end
|
982
|
+
|
983
|
+
if @format == :mkv
|
984
|
+
capabilities = get_muxer_capabilities
|
985
|
+
@mkv_options = ['-default_mode', 'passthrough'] if capabilities =~ /passthrough/
|
986
|
+
end
|
890
987
|
end
|
891
988
|
|
892
989
|
def verify_tool_availability(command)
|
@@ -942,8 +1039,7 @@ HERE
|
|
942
1039
|
] + (encoder =~ /vaapi$/ ? ['-filter:v', 'format=nv12,hwupload'] : []) + [
|
943
1040
|
'-c:v', encoder,
|
944
1041
|
'-b:v', '1000k'
|
945
|
-
] + (encoder =~ /nvenc$/ ? ['-rc:v',
|
946
|
-
(encoder == 'h264_nvenc' ? ['-temporal-aq:v', '1'] : []) +
|
1042
|
+
] + (encoder =~ /nvenc$/ ? ['-rc:v', @nvenc_rc_mode] : []) +
|
947
1043
|
(encoder == 'h264_qsv' ? ['-look_ahead:v', '1'] : []) +
|
948
1044
|
(encoder == 'hevc_qsv' ? ['-load_plugin:v', 'hevc_hw'] : []) +
|
949
1045
|
(encoder =~ /amf$/ ? ['-rc:v', 'vbr_latency'] : []) + [
|
@@ -964,18 +1060,42 @@ HERE
|
|
964
1060
|
$CHILD_STATUS.exitstatus == 0
|
965
1061
|
end
|
966
1062
|
|
1063
|
+
def get_muxer_capabilities
|
1064
|
+
Kernel.warn 'Getting muxer capabilities...'
|
1065
|
+
output = ''
|
1066
|
+
|
1067
|
+
begin
|
1068
|
+
IO.popen([
|
1069
|
+
'ffmpeg',
|
1070
|
+
'-loglevel', 'quiet',
|
1071
|
+
'-h', 'muxer=matroska'
|
1072
|
+
], :err=>[:child, :out]) do |io|
|
1073
|
+
io.each do |line|
|
1074
|
+
Kernel.warn line if @debug
|
1075
|
+
output += line
|
1076
|
+
end
|
1077
|
+
end
|
1078
|
+
rescue SystemCallError => e
|
1079
|
+
raise "getting muxer capabilities failed: #{e}"
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
fail 'getting muxer capabilities failed' unless $CHILD_STATUS.exitstatus == 0
|
1083
|
+
|
1084
|
+
output
|
1085
|
+
end
|
1086
|
+
|
967
1087
|
def process_input(path)
|
968
1088
|
seconds = Time.now.tv_sec
|
969
1089
|
|
970
1090
|
unless @scan or @detect
|
971
1091
|
output_path = File.basename(path, '.*') + '.' + @format.to_s
|
972
|
-
|
1092
|
+
fail_or_warn "output file already exists: #{output_path}" if File.exist? output_path
|
973
1093
|
|
974
1094
|
log_path = output_path + '.log'
|
975
|
-
|
1095
|
+
fail_or_warn "log file already exists: #{log_path}" if File.exist? log_path
|
976
1096
|
|
977
1097
|
tmp_log_path = "_ffmpeg_#{rand(10000..99999)}_#{$PROCESS_ID}.#{@format.to_s}.log"
|
978
|
-
|
1098
|
+
fail_or_warn "log file already exists: #{tmp_log_path}" if File.exist? tmp_log_path
|
979
1099
|
end
|
980
1100
|
|
981
1101
|
media_info = scan_media(path)
|
@@ -1034,7 +1154,7 @@ HERE
|
|
1034
1154
|
get_audio_options(media_info) +
|
1035
1155
|
get_subtitle_options(media_info, burn_subtitle) + [
|
1036
1156
|
'-metadata:g', 'title='
|
1037
|
-
] + (@format == :
|
1157
|
+
] + (@format == :mkv ? @mkv_options : ['-movflags', 'disable_chpl']) + [
|
1038
1158
|
output_path
|
1039
1159
|
]
|
1040
1160
|
|
@@ -1090,6 +1210,14 @@ HERE
|
|
1090
1210
|
Kernel.warn "\nElapsed time: #{seconds_to_time(Time.now.tv_sec - seconds)}\n\n"
|
1091
1211
|
end
|
1092
1212
|
|
1213
|
+
def fail_or_warn(message)
|
1214
|
+
if @dry_run
|
1215
|
+
Kernel.warn "#{$PROGRAM_NAME}: #{message}"
|
1216
|
+
else
|
1217
|
+
fail message
|
1218
|
+
end
|
1219
|
+
end
|
1220
|
+
|
1093
1221
|
def scan_media(path)
|
1094
1222
|
Kernel.warn 'Scanning media...'
|
1095
1223
|
output = ''
|
@@ -1333,10 +1461,10 @@ HERE
|
|
1333
1461
|
drawbox_string = "#{crop[:x]}:#{crop[:y]}:#{crop[:width]}:#{crop[:height]}"
|
1334
1462
|
puts
|
1335
1463
|
puts escape_command([
|
1336
|
-
'mpv', '--no-audio',
|
1464
|
+
'mpv', '--no-audio', "--vf=lavfi=[drawbox=#{drawbox_string}:invert:1]", path
|
1337
1465
|
])
|
1338
1466
|
puts escape_command([
|
1339
|
-
'mpv', '--no-audio',
|
1467
|
+
'mpv', '--no-audio', "--vf=crop=#{crop_string}", path
|
1340
1468
|
])
|
1341
1469
|
puts
|
1342
1470
|
puts escape_command([
|
@@ -1435,48 +1563,20 @@ HERE
|
|
1435
1563
|
end
|
1436
1564
|
|
1437
1565
|
def get_video_options(media_info, video, burn_subtitle, crop)
|
1438
|
-
if @decoder_type == :cuvid
|
1439
|
-
cuvid_decoder = case video['codec_name']
|
1440
|
-
when 'mpeg1video'
|
1441
|
-
'mpeg1_cuvid'
|
1442
|
-
when 'mpeg2video'
|
1443
|
-
'mpeg2_cuvid'
|
1444
|
-
when 'mjpeg'
|
1445
|
-
'mjpeg_cuvid'
|
1446
|
-
when 'mpeg4'
|
1447
|
-
'mpeg4_cuvid'
|
1448
|
-
when 'h264'
|
1449
|
-
'h264_cuvid'
|
1450
|
-
when 'vc1'
|
1451
|
-
'vc1_cuvid'
|
1452
|
-
when 'vp8'
|
1453
|
-
'vp8_cuvid'
|
1454
|
-
when 'vp9'
|
1455
|
-
'vp9_cuvid'
|
1456
|
-
when 'hevc'
|
1457
|
-
'hevc_cuvid'
|
1458
|
-
end
|
1459
|
-
else
|
1460
|
-
cuvid_decoder = nil
|
1461
|
-
end
|
1462
|
-
|
1463
|
-
cuvid_options = []
|
1464
|
-
|
1465
1566
|
if burn_subtitle.nil?
|
1466
1567
|
overlay_filter = nil
|
1467
1568
|
else
|
1468
1569
|
overlay_filter = "[0:#{burn_subtitle['index']}]overlay"
|
1469
|
-
cuvid_decoder = nil
|
1470
1570
|
end
|
1471
1571
|
|
1472
1572
|
deinterlace = @deinterlace
|
1473
1573
|
rate = @rate
|
1474
1574
|
|
1475
1575
|
if @enable_filters
|
1476
|
-
if video['avg_frame_rate'] == '30000/1001' or video
|
1576
|
+
if video['avg_frame_rate'] == '30000/1001' or video.fetch('field_order', 'progressive') != 'progressive'
|
1477
1577
|
deinterlace = true
|
1478
1578
|
|
1479
|
-
if video['codec_name'] == 'mpeg2video'
|
1579
|
+
if video['codec_name'] == 'mpeg2video' and video['avg_frame_rate'] != '25/1'
|
1480
1580
|
rate = '24000/1001'
|
1481
1581
|
end
|
1482
1582
|
end
|
@@ -1485,11 +1585,7 @@ HERE
|
|
1485
1585
|
frame_rate_filter = nil
|
1486
1586
|
|
1487
1587
|
if deinterlace
|
1488
|
-
|
1489
|
-
frame_rate_filter = 'yadif=deint=interlaced' unless @encoder == 'copy'
|
1490
|
-
else
|
1491
|
-
cuvid_options += ['-deint:v', 'adaptive']
|
1492
|
-
end
|
1588
|
+
frame_rate_filter = 'yadif=deint=interlaced' unless @encoder == 'copy'
|
1493
1589
|
end
|
1494
1590
|
|
1495
1591
|
unless rate.nil?
|
@@ -1500,7 +1596,6 @@ HERE
|
|
1500
1596
|
|
1501
1597
|
if @detelecine
|
1502
1598
|
frame_rate_filter = 'fieldmatch=order=tff:combmatch=none,decimate'
|
1503
|
-
cuvid_decoder = nil
|
1504
1599
|
end
|
1505
1600
|
|
1506
1601
|
width = video['width'].to_i
|
@@ -1515,21 +1610,9 @@ HERE
|
|
1515
1610
|
if crop.nil? or (crop == {:width => width, :height => height, :x => 0, :y => 0})
|
1516
1611
|
crop_filter = nil
|
1517
1612
|
else
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
height = crop[:height]
|
1522
|
-
|
1523
|
-
if cuvid_decoder.nil?
|
1524
|
-
crop_filter = "crop=#{width}:#{height}:#{crop[:x]}:#{crop[:y]}"
|
1525
|
-
else
|
1526
|
-
crop_filter = nil
|
1527
|
-
top = crop[:y]
|
1528
|
-
bottom = media_height - (top + height)
|
1529
|
-
left = crop[:x]
|
1530
|
-
right = media_width - (left + width)
|
1531
|
-
cuvid_options += ['-crop:v', "#{top}x#{bottom}x#{left}x#{right}"]
|
1532
|
-
end
|
1613
|
+
width = crop[:width]
|
1614
|
+
height = crop[:height]
|
1615
|
+
crop_filter = "crop=#{width}:#{height}:#{crop[:x]}:#{crop[:y]}"
|
1533
1616
|
end
|
1534
1617
|
|
1535
1618
|
if @hevc
|
@@ -1544,14 +1627,8 @@ HERE
|
|
1544
1627
|
scale = [(max_width.to_f / width), (max_height.to_f / height)].min
|
1545
1628
|
width = ((width * scale).ceil / 2) * 2
|
1546
1629
|
height = ((height * scale).ceil / 2) * 2
|
1547
|
-
|
1548
|
-
|
1549
|
-
scale_filter = "scale=#{width}:#{height}"
|
1550
|
-
scale_filter += ':flags=bicubic' unless overlay_filter.nil?
|
1551
|
-
else
|
1552
|
-
scale_filter = nil
|
1553
|
-
cuvid_options += ['-resize:v', "#{width}x#{height}"]
|
1554
|
-
end
|
1630
|
+
scale_filter = "scale=#{width}:#{height}"
|
1631
|
+
scale_filter += ':flags=bicubic' unless overlay_filter.nil?
|
1555
1632
|
else
|
1556
1633
|
scale_filter = nil
|
1557
1634
|
end
|
@@ -1562,24 +1639,52 @@ HERE
|
|
1562
1639
|
decode_options = []
|
1563
1640
|
end
|
1564
1641
|
|
1565
|
-
if
|
1566
|
-
if
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1642
|
+
if (@decode_scope == :vc1 and video['codec_name'] == 'vc1') or @decode_scope == :all
|
1643
|
+
if @encoder =~ /vaapi$/
|
1644
|
+
decode_options = [
|
1645
|
+
'-hwaccel', 'vaapi',
|
1646
|
+
'-hwaccel_device', '/dev/dri/renderD128',
|
1647
|
+
'-hwaccel_output_format', 'vaapi'
|
1648
|
+
]
|
1649
|
+
else
|
1650
|
+
if @decode_method == 'qsv' and @encoder != 'h264_qsv'
|
1651
|
+
decode_method = 'auto'
|
1573
1652
|
else
|
1574
|
-
|
1653
|
+
decode_method = @decode_method
|
1575
1654
|
end
|
1576
|
-
end
|
1577
|
-
else
|
1578
|
-
Kernel.warn "video decoder = #{cuvid_decoder}"
|
1579
1655
|
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1656
|
+
decode_options += ['-hwaccel', decode_method]
|
1657
|
+
|
1658
|
+
if decode_method == 'qsv' and
|
1659
|
+
overlay_filter.nil? and
|
1660
|
+
frame_rate_filter.nil? and
|
1661
|
+
crop_filter.nil? and
|
1662
|
+
scale_filter.nil?
|
1663
|
+
qsv_decoder = case video['codec_name']
|
1664
|
+
when 'av1'
|
1665
|
+
'av1_qsv'
|
1666
|
+
when 'h264'
|
1667
|
+
'h264_qsv'
|
1668
|
+
when 'hevc'
|
1669
|
+
'hevc_qsv'
|
1670
|
+
when 'mjpeg'
|
1671
|
+
'mjpeg_qsv'
|
1672
|
+
when 'mpeg2video'
|
1673
|
+
'mpeg2_qsv'
|
1674
|
+
when 'vc1'
|
1675
|
+
'vc1_qsv'
|
1676
|
+
when 'vp8'
|
1677
|
+
'vp8_qsv'
|
1678
|
+
when 'vp9'
|
1679
|
+
'vp9_qsv'
|
1680
|
+
else
|
1681
|
+
nil
|
1682
|
+
end
|
1683
|
+
|
1684
|
+
decode_options += ['-qsv_device', @qsv_device] unless @qsv_device.nil?
|
1685
|
+
decode_options += ['-c:v', qsv_decoder] unless qsv_decoder.nil?
|
1686
|
+
end
|
1687
|
+
end
|
1583
1688
|
end
|
1584
1689
|
|
1585
1690
|
if @encoder =~ /vaapi$/ and not decode_options.include?('-hwaccel')
|
@@ -1664,21 +1769,21 @@ HERE
|
|
1664
1769
|
end
|
1665
1770
|
|
1666
1771
|
if @bufsize.nil?
|
1667
|
-
bufsize = maxrate if @encoder =~
|
1772
|
+
bufsize = maxrate if @encoder =~ /(nvenc|libx26[45])$/
|
1668
1773
|
else
|
1669
|
-
bufsize
|
1774
|
+
unless @bufsize == 0 and @encoder =~ /nvenc$/
|
1775
|
+
bufsize = [[(bitrate * @bufsize).to_i, bitrate].max, bitrate * 4].min
|
1776
|
+
end
|
1670
1777
|
end
|
1671
1778
|
end
|
1672
1779
|
|
1673
|
-
|
1674
|
-
preset = nil
|
1675
|
-
else
|
1780
|
+
unless @preset.nil?
|
1676
1781
|
valid = false
|
1677
1782
|
|
1678
1783
|
case @encoder
|
1679
1784
|
when /nvenc$/
|
1680
1785
|
case @preset
|
1681
|
-
when 'fast', 'medium', 'slow'
|
1786
|
+
when 'fast', 'medium', 'slow', /^p[1-7]$/
|
1682
1787
|
valid = true
|
1683
1788
|
end
|
1684
1789
|
when /qsv$/
|
@@ -1695,8 +1800,6 @@ HERE
|
|
1695
1800
|
end
|
1696
1801
|
|
1697
1802
|
fail "invalid preset for encoder: #{@preset}" unless valid
|
1698
|
-
|
1699
|
-
preset = @preset
|
1700
1803
|
end
|
1701
1804
|
|
1702
1805
|
Kernel.warn 'Stream mapping:'
|
@@ -1704,7 +1807,7 @@ HERE
|
|
1704
1807
|
|
1705
1808
|
unless @encoder == 'copy'
|
1706
1809
|
text += " / #{bitrate} Kbps"
|
1707
|
-
text += " / #{preset}" unless preset.nil?
|
1810
|
+
text += " / #{@preset}" unless @preset.nil?
|
1708
1811
|
end
|
1709
1812
|
|
1710
1813
|
unless burn_subtitle.nil?
|
@@ -1717,33 +1820,15 @@ HERE
|
|
1717
1820
|
encode_options += ['-b:v', "#{bitrate}k"] unless @encoder == 'copy'
|
1718
1821
|
encode_options += ['-maxrate:v', "#{maxrate}k"] if maxrate > 0
|
1719
1822
|
encode_options += ['-bufsize:v', "#{bufsize}k"] if bufsize > 0
|
1720
|
-
encode_options += ['-preset:v', preset] unless preset.nil?
|
1823
|
+
encode_options += ['-preset:v', @preset] unless @preset.nil?
|
1721
1824
|
encode_options += ['-allow_sw:v', '1'] if @encoder =~ /videotoolbox$/ and @vt_allow_sw
|
1722
1825
|
|
1723
1826
|
if @encoder =~ /nvenc$/
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
if @hevc
|
1728
|
-
spatial_aq_option = '-spatial_aq:v'
|
1729
|
-
temporal_aq_option = '-temporal_aq:v'
|
1730
|
-
else
|
1731
|
-
spatial_aq_option = '-spatial-aq:v'
|
1732
|
-
temporal_aq_option = '-temporal-aq:v'
|
1733
|
-
end
|
1734
|
-
|
1735
|
-
if @preset.nil?
|
1736
|
-
encode_options += ['-rc:v', 'vbr_hq']
|
1737
|
-
spatial_aq = true if @nvenc_spatial_aq.nil?
|
1738
|
-
|
1739
|
-
unless @hevc
|
1740
|
-
temporal_aq = true if @nvenc_temporal_aq.nil?
|
1741
|
-
end
|
1742
|
-
end
|
1743
|
-
|
1744
|
-
encode_options += [spatial_aq_option, '1'] if spatial_aq
|
1745
|
-
encode_options += [temporal_aq_option, '1'] if temporal_aq
|
1827
|
+
encode_options += ['-rc:v', @nvenc_rc_mode]
|
1828
|
+
encode_options += ['-spatial-aq:v', '1'] if @nvenc_spatial_aq
|
1829
|
+
encode_options += ['-temporal-aq:v', '1'] if @nvenc_temporal_aq
|
1746
1830
|
encode_options += ['-rc-lookahead:v', @nvenc_lookahead.to_s] unless @nvenc_lookahead.nil?
|
1831
|
+
encode_options += ['-multipass:v', @nvenc_multipass] unless @nvenc_multipass.nil?
|
1747
1832
|
encode_options += ['-refs:v', @nvenc_refs.to_s] unless @nvenc_refs.nil?
|
1748
1833
|
encode_options += ['-bf:v', @nvenc_bframes.to_s] unless @nvenc_bframes.nil?
|
1749
1834
|
end
|
@@ -1796,6 +1881,12 @@ HERE
|
|
1796
1881
|
|
1797
1882
|
encode_options += ['-refs:v', max_refs.to_s] if refs > max_refs
|
1798
1883
|
end
|
1884
|
+
|
1885
|
+
encode_options += ['-x264-params:v', @x264_params] unless @x264_params.nil?
|
1886
|
+
end
|
1887
|
+
|
1888
|
+
if @encoder == 'libx265'
|
1889
|
+
encode_options += ['-x265-params:v', @x265_params] unless @x265_params.nil?
|
1799
1890
|
end
|
1800
1891
|
|
1801
1892
|
unless @ten_bit
|
@@ -1815,6 +1906,8 @@ HERE
|
|
1815
1906
|
'-disposition:v', 'default'
|
1816
1907
|
]
|
1817
1908
|
|
1909
|
+
encode_options += ['-tag:v', 'hvc1'] if @format == :mp4 and @hevc
|
1910
|
+
|
1818
1911
|
[decode_options, encode_options]
|
1819
1912
|
end
|
1820
1913
|
|
@@ -1945,8 +2038,8 @@ HERE
|
|
1945
2038
|
dts = (codec_name == 'dts' and track[:stream].fetch('profile', 'DTS') =~ /^DTS(?:-ES)?$/)
|
1946
2039
|
|
1947
2040
|
if track[:width] == :surround
|
1948
|
-
if codec_name == @surround_encoder or
|
1949
|
-
|
2041
|
+
if ((codec_name == @surround_encoder or codec_name == 'ac3') and
|
2042
|
+
(@keep_ac3_surround or (track[:stream]['bit_rate'].to_i / 1000) <= @surround_bitrate)) or
|
1950
2043
|
(@pass_dts and dts)
|
1951
2044
|
encoder = 'copy'
|
1952
2045
|
elsif input_channels > 2
|
@@ -2087,7 +2180,7 @@ HERE
|
|
2087
2180
|
|
2088
2181
|
options += [
|
2089
2182
|
'-map', "0:#{subtitle['index']}",
|
2090
|
-
"-c:s:#{index}", 'copy',
|
2183
|
+
"-c:s:#{index}", ((@format == :mp4 and subtitle['codec_name'] == 'subrip') ? 'mov_text' : 'copy'),
|
2091
2184
|
"-disposition:s:#{index}", (force ? 'default+forced' : '0')
|
2092
2185
|
]
|
2093
2186
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: other_video_transcoding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Melton
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: " Other Video Transcoding is a package of tools to transcode videos.\n"
|
14
14
|
email: don@blivet.com
|
@@ -25,12 +25,20 @@ files:
|
|
25
25
|
- README.md
|
26
26
|
- bin/ask-ffmpeg-log
|
27
27
|
- bin/other-transcode
|
28
|
+
- other_video_transcoding-0.1.0.gem
|
29
|
+
- other_video_transcoding-0.1.1.gem
|
30
|
+
- other_video_transcoding-0.2.0.gem
|
31
|
+
- other_video_transcoding-0.3.0.gem
|
32
|
+
- other_video_transcoding-0.3.1.gem
|
33
|
+
- other_video_transcoding-0.3.2.gem
|
34
|
+
- other_video_transcoding-0.4.0.gem
|
35
|
+
- other_video_transcoding-0.5.0.gem
|
28
36
|
- other_video_transcoding.gemspec
|
29
37
|
homepage: https://github.com/donmelton/other_video_transcoding
|
30
38
|
licenses:
|
31
39
|
- MIT
|
32
40
|
metadata: {}
|
33
|
-
post_install_message:
|
41
|
+
post_install_message:
|
34
42
|
rdoc_options: []
|
35
43
|
require_paths:
|
36
44
|
- lib
|
@@ -46,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
54
|
version: '0'
|
47
55
|
requirements: []
|
48
56
|
rubygems_version: 3.1.2
|
49
|
-
signing_key:
|
57
|
+
signing_key:
|
50
58
|
specification_version: 4
|
51
59
|
summary: Other tools to transcode videos.
|
52
60
|
test_files: []
|