other_video_transcoding 0.3.1 → 0.7.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 +79 -0
- data/LICENSE +1 -1
- data/README.md +1 -3
- data/bin/ask-ffmpeg-log +7 -7
- data/bin/other-transcode +310 -190
- 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-0.6.0.gem +0 -0
- data/other_video_transcoding.gemspec +1 -1
- metadata +14 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4273472e881f7379241d7ea8f6a3576b861f92c02155ad3c786fbee68cf1a376
|
4
|
+
data.tar.gz: 38e2083ce586a71c114948efccb2877a817012ea0fdfdda1f0fce371070e80ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3d2b8f89b14154307b7a89c2f0ecb6368b33f9f9011363b749dac85645fd309f2cf32a8f2b3355736a29f1e74814c47aca2ea81ff70fa2e0d0e1ea0221c3c5d
|
7
|
+
data.tar.gz: 1b593c97ca2097033d068a44a5f924b413f5ead1858592efb05db115631b106500edf887ff032629b9dde6e6d307d652ddcee11af7c020046199c72602f2300f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,85 @@
|
|
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.7.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.7.0)
|
6
|
+
|
7
|
+
Monday, January 4, 2021
|
8
|
+
|
9
|
+
* Modify `other-transcode` to lower default target bitrates in order to significantly reduce the size of transcoded output at the risk of a slight reduction in perceived quality. Via [ #89](https://github.com/donmelton/other_video_transcoding/issues/89).
|
10
|
+
|
11
|
+
H.264 video:
|
12
|
+
|
13
|
+
Resolution | old | new
|
14
|
+
--- | --- | ---
|
15
|
+
1080p (Blu-ray video) | 8000 Kbps | 6000 Kbps
|
16
|
+
720p | 4000 Kbps | 3000 Kbps
|
17
|
+
480p (DVD video) | 2000 Kbps | 1500 Kbps
|
18
|
+
|
19
|
+
HEVC video:
|
20
|
+
|
21
|
+
Resolution | old | new
|
22
|
+
--- | --- | ---
|
23
|
+
1080p (Blu-ray video) | 6000 Kbps | 4000 Kbps
|
24
|
+
720p | 3000 Kbps | 2000 Kbps
|
25
|
+
480p (DVD video) | 1500 Kbps | 1000 Kbps
|
26
|
+
|
27
|
+
Dolby Digital Plus (Enhanced AC-3) audio:
|
28
|
+
|
29
|
+
Channels | old | new
|
30
|
+
--- | --- | ---
|
31
|
+
Surround | 640 Kbps | 384 Kbps
|
32
|
+
Stereo | 256 Kbps | 192 Kbps
|
33
|
+
Mono | 128 Kbps | 96 Kbps
|
34
|
+
|
35
|
+
Note: There are no changes to default target bitrates for Dolby Digital (AC-3) and AAC audio formats.
|
36
|
+
|
37
|
+
* Change the `--eac3` option in `other-transcode` to use Dolby Digital Plus format for _all_ transcoded audio instead of just surround output.
|
38
|
+
* Deprecate the `--all-eac3` option in `other-transcode` since the `--eac3` option now has the same behavior.
|
39
|
+
* Add a `--aac-stereo` option to `other-transcode`. This uses AAC format for transcoded stereo audio output so it can be paired with `--eac3` to get that option's old behavior.
|
40
|
+
* Add a `--8-bit-vc1` option. When the color depth is currently 10-bit, this option uses an 8-bit color depth _for video inputs in VC-1 format only_.
|
41
|
+
|
42
|
+
## [0.6.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.6.0)
|
43
|
+
|
44
|
+
Tuesday, December 22, 2020
|
45
|
+
|
46
|
+
* 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.
|
47
|
+
* 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`.
|
48
|
+
* 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.
|
49
|
+
* 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.
|
50
|
+
* 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.
|
51
|
+
|
52
|
+
## [0.5.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.5.0)
|
53
|
+
|
54
|
+
Tuesday, November 24, 2020
|
55
|
+
|
56
|
+
* 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.
|
57
|
+
* Remove all deprecated options and arguments from `other-transcode`.
|
58
|
+
|
59
|
+
## [0.4.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.4.0)
|
60
|
+
|
61
|
+
Sunday, November 1, 2020
|
62
|
+
|
63
|
+
* 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:
|
64
|
+
* 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.
|
65
|
+
* 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.
|
66
|
+
* 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.
|
67
|
+
* Add a `--nvenc-rc-mode` option to `other-transcode` for backward comaptibility with `ffmpeg` version 4.3.1 and older.
|
68
|
+
* 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.
|
69
|
+
* Deprecate the `--cuvid` option in `other-transcode` because the CUDA decoder is faster and more flexible.
|
70
|
+
* Deprecate `--preset none` in `other-transcode` because it's no longer necessary.
|
71
|
+
* Always use hyphen-based spellings of Nvidia AQ options in `ffmpeg` commands generated by `other-transcode`.
|
72
|
+
* Add `--x264-params` and `--x265-params` options to `other-transcode` for _very_ advanced manipulation of the `x264` and `x265` software encoders.
|
73
|
+
* 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.
|
74
|
+
* Update the link to Docker containers for Linux in the "README" document. Thanks, @ttyS0!
|
75
|
+
|
76
|
+
## [0.3.2](https://github.com/donmelton/other_video_transcoding/releases/tag/0.3.2)
|
77
|
+
|
78
|
+
Friday, September 11, 2020
|
79
|
+
|
80
|
+
* 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.
|
81
|
+
* 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).
|
82
|
+
* 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).
|
83
|
+
|
5
84
|
## [0.3.1](https://github.com/donmelton/other_video_transcoding/releases/tag/0.3.1)
|
6
85
|
|
7
86
|
Tuesday, May 26, 2020
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -64,9 +64,7 @@ Additional documentation for installing these programs on Windows is available i
|
|
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
|
68
|
-
|
69
|
-
https://github.com/ttyS0/docker-transcode-vaapi
|
67
|
+
https://github.com/ttyS0/docker-other-transcode
|
70
68
|
|
71
69
|
On macOS, all of these programs can be easily installed via [Homebrew](http://brew.sh/), an optional package manager:
|
72
70
|
|
data/bin/ask-ffmpeg-log
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# ask-ffmpeg-log
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019-
|
5
|
+
# Copyright (c) 2019-2021 Don Melton
|
6
6
|
#
|
7
7
|
|
8
8
|
require 'abbrev'
|
@@ -15,14 +15,14 @@ module Transcoding
|
|
15
15
|
|
16
16
|
class Command
|
17
17
|
def about
|
18
|
-
|
19
|
-
ask-ffmpeg-log 0.
|
20
|
-
Copyright (c) 2019-
|
21
|
-
HERE
|
18
|
+
<<-HERE
|
19
|
+
ask-ffmpeg-log 0.7.0
|
20
|
+
Copyright (c) 2019-2021 Don Melton
|
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
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# other-transcode
|
4
4
|
#
|
5
|
-
# Copyright (c) 2019-
|
5
|
+
# Copyright (c) 2019-2021 Don Melton
|
6
6
|
#
|
7
7
|
|
8
8
|
require 'English'
|
@@ -17,14 +17,14 @@ module Transcoding
|
|
17
17
|
|
18
18
|
class Command
|
19
19
|
def about
|
20
|
-
|
21
|
-
other-transcode 0.
|
22
|
-
Copyright (c) 2019-
|
23
|
-
HERE
|
20
|
+
<<-HERE
|
21
|
+
other-transcode 0.7.0
|
22
|
+
Copyright (c) 2019-2021 Don Melton
|
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
|
@@ -91,21 +91,27 @@ HERE
|
|
91
91
|
--x264 use x264 software video encoder
|
92
92
|
--x265 use x265 " " "
|
93
93
|
--10-bit, --no-10-bit
|
94
|
-
use 10-bit
|
94
|
+
use 10-bit color depth (default: not used for H.264,
|
95
95
|
used for HEVC with Nvidia, Intel and x265 encoders)
|
96
|
-
--
|
97
|
-
|
96
|
+
--8-bit-vc1 use 8-bit color depth for VC-1 format only
|
97
|
+
--preset NAME apply video encoder preset
|
98
98
|
--decode vc1|all|none
|
99
99
|
set scope of automatic hardware decoder acceleration
|
100
100
|
(default: vc1 for VC-1 format only)
|
101
|
-
--
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
--cuda, --no-cuda
|
102
|
+
enable or disable scoped use of Nvidia video decoder
|
103
|
+
instead of generic hardware decoder
|
104
|
+
(default: enabled when using Nvidia video encoder,
|
105
|
+
disabled when using other encoders)
|
106
|
+
--qsv-decoder enable scoped use of Intel Quick Sync video decoder
|
107
|
+
instead of generic hardware decoder
|
108
|
+
--qsv-device DEVICE
|
109
|
+
enable scoped use of QSV decoder for specific device
|
110
|
+
HERE
|
105
111
|
end
|
106
112
|
|
107
113
|
def usage8
|
108
|
-
|
114
|
+
<<-HERE
|
109
115
|
--target [2160p=|1080p=|720p=|480p=]BITRATE
|
110
116
|
set video bitrate target (default: based on input)
|
111
117
|
or target for specific input resolution
|
@@ -113,11 +119,11 @@ HERE
|
|
113
119
|
set video crop geometry (default: none)
|
114
120
|
or automatically detect it
|
115
121
|
--720p fit video within 1280x720 pixel bounds
|
116
|
-
HERE
|
122
|
+
HERE
|
117
123
|
end
|
118
124
|
|
119
125
|
def usage9
|
120
|
-
|
126
|
+
<<-HERE
|
121
127
|
--1080p " " " 1920x1080 " "
|
122
128
|
--deinterlace reduce interlace artifacts without changing frame rate
|
123
129
|
(applied automatically for some inputs)
|
@@ -126,11 +132,11 @@ HERE
|
|
126
132
|
--detelecine drop duplicate frames to restore original frame rate
|
127
133
|
(disables any deinterlacing and forced frame rate)
|
128
134
|
--no-filters disable any automatic adjustments via filters
|
129
|
-
HERE
|
135
|
+
HERE
|
130
136
|
end
|
131
137
|
|
132
138
|
def usage10
|
133
|
-
|
139
|
+
<<-HERE
|
134
140
|
--rc-maxrate FACTOR, --rc-bufsize FACTOR
|
135
141
|
set ratecontrol maximum rate and/or buffer size
|
136
142
|
as multiple of video bitrate target
|
@@ -140,17 +146,20 @@ Apple Video Toolbox encoder options:
|
|
140
146
|
--vt-allow-sw allow software encoding
|
141
147
|
|
142
148
|
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)
|
149
|
+
--nvenc-spatial-aq
|
150
|
+
enable spatial adaptive quantization (AQ)
|
151
|
+
--nvenc-temporal-aq
|
152
|
+
enable temporal adaptive quantization (AQ)
|
148
153
|
--nvenc-lookahead FRAMES
|
149
154
|
set number of frames to look ahead for ratecontrol
|
155
|
+
--nvenc-multipass qres|fullres
|
156
|
+
set multipass encoding resolution
|
150
157
|
--nvenc-refs FRAMES
|
151
158
|
set number of reference frames
|
152
159
|
--nvenc-bframes FRAMES
|
153
160
|
set maximum number of B-frames
|
161
|
+
--nvenc-rc-mode vbr|vbr_hq
|
162
|
+
set ratecontrol mode (default: vbr)
|
154
163
|
|
155
164
|
Intel Quick Sync video encoder options:
|
156
165
|
--qsv-refs FRAMES
|
@@ -179,27 +188,33 @@ x264 software video encoder options:
|
|
179
188
|
--x264-quick increase encoding speed by 70-80%
|
180
189
|
with no easily perceptible loss in video quality
|
181
190
|
(avoids quality problems with some encoder presets)
|
182
|
-
|
191
|
+
--x264-params KEY=VALUE[:KEY=VALUE]...
|
192
|
+
override x264 configuration (disables other x264 options)
|
193
|
+
|
194
|
+
x265 software video encoder options:
|
195
|
+
--x265-params KEY=VALUE[:KEY=VALUE]...
|
196
|
+
override x265 configuration
|
197
|
+
HERE
|
183
198
|
end
|
184
199
|
|
185
200
|
def usage11
|
186
|
-
|
201
|
+
<<-HERE
|
187
202
|
|
188
203
|
Audio options:
|
189
204
|
--main-audio TRACK[=WIDTH]
|
190
205
|
select main audio track by number (default: 1)
|
191
206
|
with optional width (default: surround)
|
192
|
-
HERE
|
207
|
+
HERE
|
193
208
|
end
|
194
209
|
|
195
210
|
def usage12
|
196
|
-
|
211
|
+
<<-HERE
|
197
212
|
(use `original` to disable transcoding)
|
198
|
-
HERE
|
213
|
+
HERE
|
199
214
|
end
|
200
215
|
|
201
216
|
def usage13
|
202
|
-
|
217
|
+
<<-HERE
|
203
218
|
--add-audio TRACK|all|LANGUAGE|STRING[=WIDTH]
|
204
219
|
add single audio track by number
|
205
220
|
including main audio track
|
@@ -212,49 +227,53 @@ HERE
|
|
212
227
|
excluding main audio track
|
213
228
|
(comparison is case-insensitve)
|
214
229
|
with optional width (default: stereo)
|
215
|
-
HERE
|
230
|
+
HERE
|
216
231
|
end
|
217
232
|
|
218
233
|
def usage14
|
219
|
-
|
234
|
+
<<-HERE
|
220
235
|
(use `original` to disable transcoding)
|
221
|
-
HERE
|
236
|
+
HERE
|
222
237
|
end
|
223
238
|
|
224
239
|
def usage15
|
225
|
-
|
240
|
+
<<-HERE
|
226
241
|
--surround-bitrate BITRATE
|
227
242
|
set surround audio bitrate (default: 640)
|
228
243
|
--stereo-bitrate BITRATE
|
229
244
|
set stereo audio bitrate (default: 256)
|
230
|
-
HERE
|
245
|
+
HERE
|
231
246
|
end
|
232
247
|
|
233
248
|
def usage16
|
234
|
-
|
249
|
+
<<-HERE
|
235
250
|
--mono-bitrate BITRATE
|
236
251
|
set mono audio bitrate (default: 50% of stereo bitrate)
|
237
|
-
HERE
|
252
|
+
HERE
|
238
253
|
end
|
239
254
|
|
240
255
|
def usage17
|
241
|
-
|
242
|
-
--eac3 use
|
243
|
-
|
256
|
+
<<-HERE
|
257
|
+
--eac3 use Dolby Digital Plus (E-AC-3) format for all audio
|
258
|
+
(default bitrates: 384 for surround, 192 for stereo)
|
259
|
+
HERE
|
244
260
|
end
|
245
261
|
|
246
262
|
def usage18
|
247
|
-
|
248
|
-
--
|
263
|
+
<<-HERE
|
264
|
+
--aac-stereo use AAC format for stereo audio
|
265
|
+
--limit-ac3-surround
|
266
|
+
don't copy surround audio in AC-3 format
|
267
|
+
when orginal bitrate is above transcoding bitrate
|
249
268
|
--keep-ac3-stereo
|
250
269
|
copy stereo and mono audio in AC-3 format
|
251
270
|
even when orginal bitrate is above transcoding bitrate
|
252
271
|
--pass-dts enable passthrough of audio in DTS and DTS-ES formats
|
253
|
-
HERE
|
272
|
+
HERE
|
254
273
|
end
|
255
274
|
|
256
275
|
def usage19
|
257
|
-
|
276
|
+
<<-HERE
|
258
277
|
|
259
278
|
Subtitle options:
|
260
279
|
--add-subtitle TRACK[=forced]|auto|all|LANGUAGE|STRING
|
@@ -279,7 +298,7 @@ Other options:
|
|
279
298
|
--version output version information and exit
|
280
299
|
|
281
300
|
Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
|
282
|
-
HERE
|
301
|
+
HERE
|
283
302
|
end
|
284
303
|
|
285
304
|
def initialize
|
@@ -290,15 +309,18 @@ HERE
|
|
290
309
|
@detect = false
|
291
310
|
@preview = false
|
292
311
|
@format = :mkv
|
312
|
+
@mkv_options = []
|
293
313
|
@copy_track_names = false
|
294
314
|
@max_muxing_queue_size = nil
|
295
315
|
@dry_run = false
|
296
316
|
@hevc = false
|
297
317
|
@encoder = nil
|
298
318
|
@ten_bit = nil
|
319
|
+
@eight_bit_vc1 = false
|
299
320
|
@preset = nil
|
300
321
|
@decode_scope = :vc1
|
301
|
-
@
|
322
|
+
@decode_method = nil
|
323
|
+
@qsv_device = nil
|
302
324
|
@target_2160p = nil
|
303
325
|
@target_1080p = nil
|
304
326
|
@target_720p = nil
|
@@ -314,11 +336,13 @@ HERE
|
|
314
336
|
@maxrate = nil
|
315
337
|
@bufsize = nil
|
316
338
|
@vt_allow_sw = false
|
317
|
-
@nvenc_spatial_aq =
|
318
|
-
@nvenc_temporal_aq =
|
339
|
+
@nvenc_spatial_aq = false
|
340
|
+
@nvenc_temporal_aq = false
|
319
341
|
@nvenc_lookahead = nil
|
342
|
+
@nvenc_multipass = nil
|
320
343
|
@nvenc_refs = nil
|
321
344
|
@nvenc_bframes = nil
|
345
|
+
@nvenc_rc_mode = 'vbr'
|
322
346
|
@qsv_refs = nil
|
323
347
|
@qsv_bframes = nil
|
324
348
|
@amf_quality = nil
|
@@ -330,17 +354,20 @@ HERE
|
|
330
354
|
@x264_avbr = false
|
331
355
|
@x264_mbtree = false
|
332
356
|
@x264_quick = false
|
357
|
+
@x264_params = nil
|
358
|
+
@x265_params = nil
|
333
359
|
@audio_selections = [{
|
334
360
|
:track => 1,
|
335
361
|
:language => nil,
|
336
362
|
:title => nil,
|
337
363
|
:width => :surround
|
338
364
|
}]
|
339
|
-
@surround_bitrate =
|
340
|
-
@stereo_bitrate =
|
365
|
+
@surround_bitrate = nil
|
366
|
+
@stereo_bitrate = nil
|
341
367
|
@mono_bitrate = nil
|
342
368
|
@surround_encoder = 'ac3'
|
343
369
|
@stereo_encoder = nil
|
370
|
+
@keep_ac3_surround = true
|
344
371
|
@keep_ac3_stereo = false
|
345
372
|
@pass_dts = false
|
346
373
|
@subtitle_selections = []
|
@@ -478,6 +505,12 @@ HERE
|
|
478
505
|
|
479
506
|
opts.on '--[no-]10-bit' do |arg|
|
480
507
|
@ten_bit = arg
|
508
|
+
@eight_bit_vc1 = false
|
509
|
+
@encoder = nil if @encoder == 'copy'
|
510
|
+
end
|
511
|
+
|
512
|
+
opts.on '--8-bit-vc1' do
|
513
|
+
@eight_bit_vc1 = true
|
481
514
|
@encoder = nil if @encoder == 'copy'
|
482
515
|
end
|
483
516
|
|
@@ -495,8 +528,17 @@ HERE
|
|
495
528
|
end
|
496
529
|
end
|
497
530
|
|
498
|
-
opts.on '--
|
499
|
-
@
|
531
|
+
opts.on '--[no-]cuda' do |arg|
|
532
|
+
@decode_method = arg ? 'cuda' : 'auto'
|
533
|
+
end
|
534
|
+
|
535
|
+
opts.on '--qsv-decoder' do
|
536
|
+
@decode_method = 'qsv'
|
537
|
+
end
|
538
|
+
|
539
|
+
opts.on '--qsv-device ARG' do |arg|
|
540
|
+
@qsv_device = arg
|
541
|
+
@decode_method = 'qsv'
|
500
542
|
end
|
501
543
|
|
502
544
|
opts.on '--target ARG' do |arg|
|
@@ -553,7 +595,7 @@ HERE
|
|
553
595
|
@deinterlace = true
|
554
596
|
@detelecine = false
|
555
597
|
@enable_filters = false
|
556
|
-
@encoder = nil if @encoder == 'copy'
|
598
|
+
@encoder = nil if @encoder == 'copy'
|
557
599
|
end
|
558
600
|
|
559
601
|
opts.on '--rate ARG' do |arg|
|
@@ -619,19 +661,35 @@ HERE
|
|
619
661
|
@vt_allow_sw = true
|
620
662
|
end
|
621
663
|
|
622
|
-
opts.on '--
|
664
|
+
opts.on '--nvenc-spatial-aq' do
|
623
665
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
624
|
-
@nvenc_spatial_aq =
|
666
|
+
@nvenc_spatial_aq = true
|
625
667
|
end
|
626
668
|
|
627
|
-
opts.on '--
|
669
|
+
opts.on '--nvenc-temporal-aq' do
|
628
670
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
629
|
-
@nvenc_temporal_aq =
|
671
|
+
@nvenc_temporal_aq = true
|
630
672
|
end
|
631
673
|
|
632
674
|
opts.on '--nvenc-lookahead ARG', Integer do |arg|
|
633
675
|
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
634
|
-
|
676
|
+
|
677
|
+
if arg > 0
|
678
|
+
@nvenc_lookahead = [arg, 32].min
|
679
|
+
else
|
680
|
+
@nvenc_lookahead = nil
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
opts.on '--nvenc-multipass ARG' do |arg|
|
685
|
+
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
686
|
+
|
687
|
+
@nvenc_multipass = case arg
|
688
|
+
when 'qres', 'fullres'
|
689
|
+
arg
|
690
|
+
else
|
691
|
+
fail UsageError, "invalid multipass resolution argument: #{arg}"
|
692
|
+
end
|
635
693
|
end
|
636
694
|
|
637
695
|
opts.on '--nvenc-refs ARG', Integer do |arg|
|
@@ -644,6 +702,17 @@ HERE
|
|
644
702
|
@nvenc_bframes = [[arg, 0].max, 4].min
|
645
703
|
end
|
646
704
|
|
705
|
+
opts.on '--nvenc-rc-mode ARG' do |arg|
|
706
|
+
@encoder = @hevc ? 'hevc_nvenc' : 'h264_nvenc'
|
707
|
+
|
708
|
+
@nvenc_rc_mode = case arg
|
709
|
+
when 'vbr', 'vbr_hq'
|
710
|
+
arg
|
711
|
+
else
|
712
|
+
fail UsageError, "invalid rate control argument: #{arg}"
|
713
|
+
end
|
714
|
+
end
|
715
|
+
|
647
716
|
opts.on '--qsv-refs ARG', Integer do |arg|
|
648
717
|
@encoder = @hevc ? 'hevc_qsv' : 'h264_qsv'
|
649
718
|
@qsv_refs = [arg, 0].max
|
@@ -695,6 +764,7 @@ HERE
|
|
695
764
|
@hevc = false
|
696
765
|
@x264_avbr = true
|
697
766
|
@x264_mbtree = false
|
767
|
+
@x264_params = nil
|
698
768
|
end
|
699
769
|
|
700
770
|
opts.on '--x264-mbtree' do
|
@@ -702,15 +772,40 @@ HERE
|
|
702
772
|
@hevc = false
|
703
773
|
@x264_mbtree = true
|
704
774
|
@x264_avbr = false
|
775
|
+
@x264_params = nil
|
705
776
|
end
|
706
777
|
|
707
778
|
opts.on '--x264-quick' do
|
708
779
|
@encoder = 'libx264'
|
709
780
|
@hevc = false
|
710
781
|
@x264_quick = true
|
782
|
+
@x264_params = nil
|
711
783
|
@preset = nil
|
712
784
|
end
|
713
785
|
|
786
|
+
opts.on '--x264-params ARG' do |arg|
|
787
|
+
arg.split ':' do |param|
|
788
|
+
fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,]+$/
|
789
|
+
end
|
790
|
+
|
791
|
+
@encoder = 'libx264'
|
792
|
+
@hevc = false
|
793
|
+
@x264_params = arg
|
794
|
+
@x264_avbr = false
|
795
|
+
@x264_mbtree = true
|
796
|
+
@x264_quick = false
|
797
|
+
end
|
798
|
+
|
799
|
+
opts.on '--x265-params ARG' do |arg|
|
800
|
+
arg.split ':' do |param|
|
801
|
+
fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,]+$/
|
802
|
+
end
|
803
|
+
|
804
|
+
@encoder = 'libx265'
|
805
|
+
@hevc = true
|
806
|
+
@x265_params = arg
|
807
|
+
end
|
808
|
+
|
714
809
|
opts.on '--main-audio ARG' do |arg|
|
715
810
|
if arg =~ /^([0-9]+)(?:=(stereo|surround|original))?$/
|
716
811
|
@audio_selections[0][:track] = $1.to_i
|
@@ -762,13 +857,25 @@ HERE
|
|
762
857
|
|
763
858
|
opts.on '--eac3' do
|
764
859
|
@surround_encoder = 'eac3'
|
860
|
+
@stereo_encoder = 'eac3'
|
765
861
|
end
|
766
862
|
|
767
863
|
opts.on '--all-eac3' do
|
864
|
+
Kernel.warn '**********'
|
865
|
+
Kernel.warn 'Using deprecated option: --all-eac3'
|
866
|
+
Kernel.warn '**********'
|
768
867
|
@surround_encoder = 'eac3'
|
769
868
|
@stereo_encoder = 'eac3'
|
770
869
|
end
|
771
870
|
|
871
|
+
opts.on '--aac-stereo' do
|
872
|
+
@stereo_encoder = nil
|
873
|
+
end
|
874
|
+
|
875
|
+
opts.on '--limit-ac3-surround' do
|
876
|
+
@keep_ac3_surround = false
|
877
|
+
end
|
878
|
+
|
772
879
|
opts.on '--keep-ac3-stereo' do
|
773
880
|
@keep_ac3_stereo = true
|
774
881
|
end
|
@@ -827,13 +934,31 @@ HERE
|
|
827
934
|
def configure(path)
|
828
935
|
@audio_selections.uniq!
|
829
936
|
@subtitle_selections.uniq!
|
830
|
-
|
831
|
-
|
937
|
+
|
938
|
+
if @surround_encoder == 'eac3'
|
939
|
+
@surround_bitrate ||= 384
|
940
|
+
@surround_bitrate = [[@surround_bitrate, 192].max, 768].min
|
941
|
+
else
|
942
|
+
@surround_bitrate ||= 640
|
943
|
+
@surround_bitrate = [[@surround_bitrate, 256].max, 640].min
|
944
|
+
end
|
945
|
+
|
946
|
+
if @stereo_encoder == 'eac3'
|
947
|
+
@stereo_bitrate ||= 192
|
948
|
+
@stereo_bitrate = [[@stereo_bitrate, 96].max, 768].min
|
949
|
+
else
|
950
|
+
@stereo_bitrate ||= 256
|
951
|
+
@stereo_bitrate = [[@stereo_bitrate, 128].max, 320].min
|
952
|
+
end
|
832
953
|
|
833
954
|
if @mono_bitrate.nil?
|
834
955
|
@mono_bitrate = @stereo_bitrate / 2
|
835
956
|
else
|
836
|
-
|
957
|
+
if @stereo_encoder == 'eac3'
|
958
|
+
@mono_bitrate = [[@mono_bitrate, 48].max, 768].min
|
959
|
+
else
|
960
|
+
@mono_bitrate = [[@mono_bitrate, 64].max, 256].min
|
961
|
+
end
|
837
962
|
end
|
838
963
|
|
839
964
|
[
|
@@ -875,10 +1000,11 @@ HERE
|
|
875
1000
|
end
|
876
1001
|
|
877
1002
|
@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 ||=
|
1003
|
+
@target_2160p ||= @hevc ? 8000 : 12000
|
1004
|
+
@target_1080p ||= @hevc ? 4000 : 6000
|
1005
|
+
@target_720p ||= @hevc ? 2000 : 3000
|
1006
|
+
@target_480p ||= @hevc ? 1000 : 1500
|
1007
|
+
@decode_method ||= @encoder =~ /nvenc$/ ? 'cuda' : 'auto'
|
882
1008
|
|
883
1009
|
if @stereo_encoder.nil?
|
884
1010
|
if encoders =~ /aac_at/ or encoders =~ /libfdk_aac/
|
@@ -887,6 +1013,11 @@ HERE
|
|
887
1013
|
@stereo_encoder = 'aac'
|
888
1014
|
end
|
889
1015
|
end
|
1016
|
+
|
1017
|
+
if @format == :mkv
|
1018
|
+
capabilities = get_muxer_capabilities
|
1019
|
+
@mkv_options = ['-default_mode', 'passthrough'] if capabilities =~ /passthrough/
|
1020
|
+
end
|
890
1021
|
end
|
891
1022
|
|
892
1023
|
def verify_tool_availability(command)
|
@@ -942,8 +1073,7 @@ HERE
|
|
942
1073
|
] + (encoder =~ /vaapi$/ ? ['-filter:v', 'format=nv12,hwupload'] : []) + [
|
943
1074
|
'-c:v', encoder,
|
944
1075
|
'-b:v', '1000k'
|
945
|
-
] + (encoder =~ /nvenc$/ ? ['-rc:v',
|
946
|
-
(encoder == 'h264_nvenc' ? ['-temporal-aq:v', '1'] : []) +
|
1076
|
+
] + (encoder =~ /nvenc$/ ? ['-rc:v', @nvenc_rc_mode] : []) +
|
947
1077
|
(encoder == 'h264_qsv' ? ['-look_ahead:v', '1'] : []) +
|
948
1078
|
(encoder == 'hevc_qsv' ? ['-load_plugin:v', 'hevc_hw'] : []) +
|
949
1079
|
(encoder =~ /amf$/ ? ['-rc:v', 'vbr_latency'] : []) + [
|
@@ -964,6 +1094,30 @@ HERE
|
|
964
1094
|
$CHILD_STATUS.exitstatus == 0
|
965
1095
|
end
|
966
1096
|
|
1097
|
+
def get_muxer_capabilities
|
1098
|
+
Kernel.warn 'Getting muxer capabilities...'
|
1099
|
+
output = ''
|
1100
|
+
|
1101
|
+
begin
|
1102
|
+
IO.popen([
|
1103
|
+
'ffmpeg',
|
1104
|
+
'-loglevel', 'quiet',
|
1105
|
+
'-h', 'muxer=matroska'
|
1106
|
+
], :err=>[:child, :out]) do |io|
|
1107
|
+
io.each do |line|
|
1108
|
+
Kernel.warn line if @debug
|
1109
|
+
output += line
|
1110
|
+
end
|
1111
|
+
end
|
1112
|
+
rescue SystemCallError => e
|
1113
|
+
raise "getting muxer capabilities failed: #{e}"
|
1114
|
+
end
|
1115
|
+
|
1116
|
+
fail 'getting muxer capabilities failed' unless $CHILD_STATUS.exitstatus == 0
|
1117
|
+
|
1118
|
+
output
|
1119
|
+
end
|
1120
|
+
|
967
1121
|
def process_input(path)
|
968
1122
|
seconds = Time.now.tv_sec
|
969
1123
|
|
@@ -1034,7 +1188,7 @@ HERE
|
|
1034
1188
|
get_audio_options(media_info) +
|
1035
1189
|
get_subtitle_options(media_info, burn_subtitle) + [
|
1036
1190
|
'-metadata:g', 'title='
|
1037
|
-
] + (@format == :
|
1191
|
+
] + (@format == :mkv ? @mkv_options : ['-movflags', 'disable_chpl']) + [
|
1038
1192
|
output_path
|
1039
1193
|
]
|
1040
1194
|
|
@@ -1443,45 +1597,17 @@ HERE
|
|
1443
1597
|
end
|
1444
1598
|
|
1445
1599
|
def get_video_options(media_info, video, burn_subtitle, crop)
|
1446
|
-
if @decoder_type == :cuvid
|
1447
|
-
cuvid_decoder = case video['codec_name']
|
1448
|
-
when 'mpeg1video'
|
1449
|
-
'mpeg1_cuvid'
|
1450
|
-
when 'mpeg2video'
|
1451
|
-
'mpeg2_cuvid'
|
1452
|
-
when 'mjpeg'
|
1453
|
-
'mjpeg_cuvid'
|
1454
|
-
when 'mpeg4'
|
1455
|
-
'mpeg4_cuvid'
|
1456
|
-
when 'h264'
|
1457
|
-
'h264_cuvid'
|
1458
|
-
when 'vc1'
|
1459
|
-
'vc1_cuvid'
|
1460
|
-
when 'vp8'
|
1461
|
-
'vp8_cuvid'
|
1462
|
-
when 'vp9'
|
1463
|
-
'vp9_cuvid'
|
1464
|
-
when 'hevc'
|
1465
|
-
'hevc_cuvid'
|
1466
|
-
end
|
1467
|
-
else
|
1468
|
-
cuvid_decoder = nil
|
1469
|
-
end
|
1470
|
-
|
1471
|
-
cuvid_options = []
|
1472
|
-
|
1473
1600
|
if burn_subtitle.nil?
|
1474
1601
|
overlay_filter = nil
|
1475
1602
|
else
|
1476
1603
|
overlay_filter = "[0:#{burn_subtitle['index']}]overlay"
|
1477
|
-
cuvid_decoder = nil
|
1478
1604
|
end
|
1479
1605
|
|
1480
1606
|
deinterlace = @deinterlace
|
1481
1607
|
rate = @rate
|
1482
1608
|
|
1483
1609
|
if @enable_filters
|
1484
|
-
if video['avg_frame_rate'] == '30000/1001' or video
|
1610
|
+
if video['avg_frame_rate'] == '30000/1001' or video.fetch('field_order', 'progressive') != 'progressive'
|
1485
1611
|
deinterlace = true
|
1486
1612
|
|
1487
1613
|
if video['codec_name'] == 'mpeg2video' and video['avg_frame_rate'] != '25/1'
|
@@ -1493,11 +1619,7 @@ HERE
|
|
1493
1619
|
frame_rate_filter = nil
|
1494
1620
|
|
1495
1621
|
if deinterlace
|
1496
|
-
|
1497
|
-
frame_rate_filter = 'yadif=deint=interlaced' unless @encoder == 'copy'
|
1498
|
-
else
|
1499
|
-
cuvid_options += ['-deint:v', 'adaptive']
|
1500
|
-
end
|
1622
|
+
frame_rate_filter = 'yadif=deint=interlaced' unless @encoder == 'copy'
|
1501
1623
|
end
|
1502
1624
|
|
1503
1625
|
unless rate.nil?
|
@@ -1508,7 +1630,6 @@ HERE
|
|
1508
1630
|
|
1509
1631
|
if @detelecine
|
1510
1632
|
frame_rate_filter = 'fieldmatch=order=tff:combmatch=none,decimate'
|
1511
|
-
cuvid_decoder = nil
|
1512
1633
|
end
|
1513
1634
|
|
1514
1635
|
width = video['width'].to_i
|
@@ -1523,21 +1644,9 @@ HERE
|
|
1523
1644
|
if crop.nil? or (crop == {:width => width, :height => height, :x => 0, :y => 0})
|
1524
1645
|
crop_filter = nil
|
1525
1646
|
else
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
height = crop[:height]
|
1530
|
-
|
1531
|
-
if cuvid_decoder.nil?
|
1532
|
-
crop_filter = "crop=#{width}:#{height}:#{crop[:x]}:#{crop[:y]}"
|
1533
|
-
else
|
1534
|
-
crop_filter = nil
|
1535
|
-
top = crop[:y]
|
1536
|
-
bottom = media_height - (top + height)
|
1537
|
-
left = crop[:x]
|
1538
|
-
right = media_width - (left + width)
|
1539
|
-
cuvid_options += ['-crop:v', "#{top}x#{bottom}x#{left}x#{right}"]
|
1540
|
-
end
|
1647
|
+
width = crop[:width]
|
1648
|
+
height = crop[:height]
|
1649
|
+
crop_filter = "crop=#{width}:#{height}:#{crop[:x]}:#{crop[:y]}"
|
1541
1650
|
end
|
1542
1651
|
|
1543
1652
|
if @hevc
|
@@ -1552,14 +1661,8 @@ HERE
|
|
1552
1661
|
scale = [(max_width.to_f / width), (max_height.to_f / height)].min
|
1553
1662
|
width = ((width * scale).ceil / 2) * 2
|
1554
1663
|
height = ((height * scale).ceil / 2) * 2
|
1555
|
-
|
1556
|
-
|
1557
|
-
scale_filter = "scale=#{width}:#{height}"
|
1558
|
-
scale_filter += ':flags=bicubic' unless overlay_filter.nil?
|
1559
|
-
else
|
1560
|
-
scale_filter = nil
|
1561
|
-
cuvid_options += ['-resize:v', "#{width}x#{height}"]
|
1562
|
-
end
|
1664
|
+
scale_filter = "scale=#{width}:#{height}"
|
1665
|
+
scale_filter += ':flags=bicubic' unless overlay_filter.nil?
|
1563
1666
|
else
|
1564
1667
|
scale_filter = nil
|
1565
1668
|
end
|
@@ -1570,24 +1673,52 @@ HERE
|
|
1570
1673
|
decode_options = []
|
1571
1674
|
end
|
1572
1675
|
|
1573
|
-
if
|
1574
|
-
if
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1676
|
+
if (@decode_scope == :vc1 and video['codec_name'] == 'vc1') or @decode_scope == :all
|
1677
|
+
if @encoder =~ /vaapi$/
|
1678
|
+
decode_options = [
|
1679
|
+
'-hwaccel', 'vaapi',
|
1680
|
+
'-hwaccel_device', '/dev/dri/renderD128',
|
1681
|
+
'-hwaccel_output_format', 'vaapi'
|
1682
|
+
]
|
1683
|
+
else
|
1684
|
+
if @decode_method == 'qsv' and @encoder != 'h264_qsv'
|
1685
|
+
decode_method = 'auto'
|
1581
1686
|
else
|
1582
|
-
|
1687
|
+
decode_method = @decode_method
|
1583
1688
|
end
|
1584
|
-
end
|
1585
|
-
else
|
1586
|
-
Kernel.warn "video decoder = #{cuvid_decoder}"
|
1587
1689
|
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1690
|
+
decode_options += ['-hwaccel', decode_method]
|
1691
|
+
|
1692
|
+
if decode_method == 'qsv' and
|
1693
|
+
overlay_filter.nil? and
|
1694
|
+
frame_rate_filter.nil? and
|
1695
|
+
crop_filter.nil? and
|
1696
|
+
scale_filter.nil?
|
1697
|
+
qsv_decoder = case video['codec_name']
|
1698
|
+
when 'av1'
|
1699
|
+
'av1_qsv'
|
1700
|
+
when 'h264'
|
1701
|
+
'h264_qsv'
|
1702
|
+
when 'hevc'
|
1703
|
+
'hevc_qsv'
|
1704
|
+
when 'mjpeg'
|
1705
|
+
'mjpeg_qsv'
|
1706
|
+
when 'mpeg2video'
|
1707
|
+
'mpeg2_qsv'
|
1708
|
+
when 'vc1'
|
1709
|
+
'vc1_qsv'
|
1710
|
+
when 'vp8'
|
1711
|
+
'vp8_qsv'
|
1712
|
+
when 'vp9'
|
1713
|
+
'vp9_qsv'
|
1714
|
+
else
|
1715
|
+
nil
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
decode_options += ['-qsv_device', @qsv_device] unless @qsv_device.nil?
|
1719
|
+
decode_options += ['-c:v', qsv_decoder] unless qsv_decoder.nil?
|
1720
|
+
end
|
1721
|
+
end
|
1591
1722
|
end
|
1592
1723
|
|
1593
1724
|
if @encoder =~ /vaapi$/ and not decode_options.include?('-hwaccel')
|
@@ -1624,7 +1755,8 @@ HERE
|
|
1624
1755
|
]
|
1625
1756
|
end
|
1626
1757
|
|
1627
|
-
|
1758
|
+
ten_bit = (@ten_bit ? (@eight_bit_vc1 ? (video['codec_name'] != 'vc1') : true) : false)
|
1759
|
+
hdr = ((video.fetch('pix_fmt', 'yuv420p') == 'yuv420p10le') and ten_bit)
|
1628
1760
|
|
1629
1761
|
if hdr
|
1630
1762
|
color_primaries = 'bt2020'
|
@@ -1672,21 +1804,21 @@ HERE
|
|
1672
1804
|
end
|
1673
1805
|
|
1674
1806
|
if @bufsize.nil?
|
1675
|
-
bufsize = maxrate if @encoder =~
|
1807
|
+
bufsize = maxrate if @encoder =~ /(nvenc|libx26[45])$/
|
1676
1808
|
else
|
1677
|
-
bufsize
|
1809
|
+
unless @bufsize == 0 and @encoder =~ /nvenc$/
|
1810
|
+
bufsize = [[(bitrate * @bufsize).to_i, bitrate].max, bitrate * 4].min
|
1811
|
+
end
|
1678
1812
|
end
|
1679
1813
|
end
|
1680
1814
|
|
1681
|
-
|
1682
|
-
preset = nil
|
1683
|
-
else
|
1815
|
+
unless @preset.nil?
|
1684
1816
|
valid = false
|
1685
1817
|
|
1686
1818
|
case @encoder
|
1687
1819
|
when /nvenc$/
|
1688
1820
|
case @preset
|
1689
|
-
when 'fast', 'medium', 'slow'
|
1821
|
+
when 'fast', 'medium', 'slow', /^p[1-7]$/
|
1690
1822
|
valid = true
|
1691
1823
|
end
|
1692
1824
|
when /qsv$/
|
@@ -1703,8 +1835,6 @@ HERE
|
|
1703
1835
|
end
|
1704
1836
|
|
1705
1837
|
fail "invalid preset for encoder: #{@preset}" unless valid
|
1706
|
-
|
1707
|
-
preset = @preset
|
1708
1838
|
end
|
1709
1839
|
|
1710
1840
|
Kernel.warn 'Stream mapping:'
|
@@ -1712,7 +1842,7 @@ HERE
|
|
1712
1842
|
|
1713
1843
|
unless @encoder == 'copy'
|
1714
1844
|
text += " / #{bitrate} Kbps"
|
1715
|
-
text += " / #{preset}" unless preset.nil?
|
1845
|
+
text += " / #{@preset}" unless @preset.nil?
|
1716
1846
|
end
|
1717
1847
|
|
1718
1848
|
unless burn_subtitle.nil?
|
@@ -1721,37 +1851,19 @@ HERE
|
|
1721
1851
|
|
1722
1852
|
Kernel.warn text
|
1723
1853
|
encode_options += ['-c:v', @encoder]
|
1724
|
-
encode_options += ['-pix_fmt:v', (@encoder =~ /(nvenc|qsv)$/ ? 'p010le' : 'yuv420p10le')] if
|
1854
|
+
encode_options += ['-pix_fmt:v', (@encoder =~ /(nvenc|qsv)$/ ? 'p010le' : 'yuv420p10le')] if ten_bit
|
1725
1855
|
encode_options += ['-b:v', "#{bitrate}k"] unless @encoder == 'copy'
|
1726
1856
|
encode_options += ['-maxrate:v', "#{maxrate}k"] if maxrate > 0
|
1727
1857
|
encode_options += ['-bufsize:v', "#{bufsize}k"] if bufsize > 0
|
1728
|
-
encode_options += ['-preset:v', preset] unless preset.nil?
|
1858
|
+
encode_options += ['-preset:v', @preset] unless @preset.nil?
|
1729
1859
|
encode_options += ['-allow_sw:v', '1'] if @encoder =~ /videotoolbox$/ and @vt_allow_sw
|
1730
1860
|
|
1731
1861
|
if @encoder =~ /nvenc$/
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
if @hevc
|
1736
|
-
spatial_aq_option = '-spatial_aq:v'
|
1737
|
-
temporal_aq_option = '-temporal_aq:v'
|
1738
|
-
else
|
1739
|
-
spatial_aq_option = '-spatial-aq:v'
|
1740
|
-
temporal_aq_option = '-temporal-aq:v'
|
1741
|
-
end
|
1742
|
-
|
1743
|
-
if @preset.nil?
|
1744
|
-
encode_options += ['-rc:v', 'vbr_hq']
|
1745
|
-
spatial_aq = true if @nvenc_spatial_aq.nil?
|
1746
|
-
|
1747
|
-
unless @hevc
|
1748
|
-
temporal_aq = true if @nvenc_temporal_aq.nil?
|
1749
|
-
end
|
1750
|
-
end
|
1751
|
-
|
1752
|
-
encode_options += [spatial_aq_option, '1'] if spatial_aq
|
1753
|
-
encode_options += [temporal_aq_option, '1'] if temporal_aq
|
1862
|
+
encode_options += ['-rc:v', @nvenc_rc_mode]
|
1863
|
+
encode_options += ['-spatial-aq:v', '1'] if @nvenc_spatial_aq
|
1864
|
+
encode_options += ['-temporal-aq:v', '1'] if @nvenc_temporal_aq
|
1754
1865
|
encode_options += ['-rc-lookahead:v', @nvenc_lookahead.to_s] unless @nvenc_lookahead.nil?
|
1866
|
+
encode_options += ['-multipass:v', @nvenc_multipass] unless @nvenc_multipass.nil?
|
1755
1867
|
encode_options += ['-refs:v', @nvenc_refs.to_s] unless @nvenc_refs.nil?
|
1756
1868
|
encode_options += ['-bf:v', @nvenc_bframes.to_s] unless @nvenc_bframes.nil?
|
1757
1869
|
end
|
@@ -1804,9 +1916,15 @@ HERE
|
|
1804
1916
|
|
1805
1917
|
encode_options += ['-refs:v', max_refs.to_s] if refs > max_refs
|
1806
1918
|
end
|
1919
|
+
|
1920
|
+
encode_options += ['-x264-params:v', @x264_params] unless @x264_params.nil?
|
1807
1921
|
end
|
1808
1922
|
|
1809
|
-
|
1923
|
+
if @encoder == 'libx265'
|
1924
|
+
encode_options += ['-x265-params:v', @x265_params] unless @x265_params.nil?
|
1925
|
+
end
|
1926
|
+
|
1927
|
+
unless ten_bit
|
1810
1928
|
encode_options += ['-profile:v', 'high'] if @encoder =~ /^(h264_nvenc|h264_amf|libx264)$/
|
1811
1929
|
end
|
1812
1930
|
|
@@ -1823,6 +1941,8 @@ HERE
|
|
1823
1941
|
'-disposition:v', 'default'
|
1824
1942
|
]
|
1825
1943
|
|
1944
|
+
encode_options += ['-tag:v', 'hvc1'] if @format == :mp4 and @hevc
|
1945
|
+
|
1826
1946
|
[decode_options, encode_options]
|
1827
1947
|
end
|
1828
1948
|
|
@@ -1953,8 +2073,8 @@ HERE
|
|
1953
2073
|
dts = (codec_name == 'dts' and track[:stream].fetch('profile', 'DTS') =~ /^DTS(?:-ES)?$/)
|
1954
2074
|
|
1955
2075
|
if track[:width] == :surround
|
1956
|
-
if codec_name == @surround_encoder or
|
1957
|
-
|
2076
|
+
if ((codec_name == @surround_encoder or codec_name == 'ac3') and
|
2077
|
+
(@keep_ac3_surround or (track[:stream]['bit_rate'].to_i / 1000) <= @surround_bitrate)) or
|
1958
2078
|
(@pass_dts and dts)
|
1959
2079
|
encoder = 'copy'
|
1960
2080
|
elsif input_channels > 2
|
@@ -2095,7 +2215,7 @@ HERE
|
|
2095
2215
|
|
2096
2216
|
options += [
|
2097
2217
|
'-map', "0:#{subtitle['index']}",
|
2098
|
-
"-c:s:#{index}", 'copy',
|
2218
|
+
"-c:s:#{index}", ((@format == :mp4 and subtitle['codec_name'] == 'subrip') ? 'mov_text' : 'copy'),
|
2099
2219
|
"-disposition:s:#{index}", (force ? 'default+forced' : '0')
|
2100
2220
|
]
|
2101
2221
|
|
Binary file
|
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.7.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:
|
11
|
+
date: 2021-01-04 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,21 @@ 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
|
36
|
+
- other_video_transcoding-0.6.0.gem
|
28
37
|
- other_video_transcoding.gemspec
|
29
38
|
homepage: https://github.com/donmelton/other_video_transcoding
|
30
39
|
licenses:
|
31
40
|
- MIT
|
32
41
|
metadata: {}
|
33
|
-
post_install_message:
|
42
|
+
post_install_message:
|
34
43
|
rdoc_options: []
|
35
44
|
require_paths:
|
36
45
|
- lib
|
@@ -46,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
55
|
version: '0'
|
47
56
|
requirements: []
|
48
57
|
rubygems_version: 3.1.2
|
49
|
-
signing_key:
|
58
|
+
signing_key:
|
50
59
|
specification_version: 4
|
51
60
|
summary: Other tools to transcode videos.
|
52
61
|
test_files: []
|