video_transcoding 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/README.md +22 -15
- data/bin/convert-video +35 -14
- data/bin/detect-crop +5 -26
- data/bin/query-handbrake-log +1 -1
- data/bin/transcode-video +39 -42
- data/lib/video_transcoding.rb +1 -1
- data/lib/video_transcoding/cli.rb +1 -1
- data/lib/video_transcoding/console.rb +1 -1
- data/lib/video_transcoding/copyright.rb +2 -2
- data/lib/video_transcoding/crop.rb +1 -1
- data/lib/video_transcoding/errors.rb +1 -1
- data/lib/video_transcoding/ffmpeg.rb +1 -1
- data/lib/video_transcoding/handbrake.rb +1 -1
- data/lib/video_transcoding/media.rb +1 -1
- data/lib/video_transcoding/mkvpropedit.rb +1 -1
- data/lib/video_transcoding/mp4track.rb +1 -1
- data/lib/video_transcoding/tool.rb +1 -1
- data/lib/video_transcoding/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cb79007469f914ec85593c97f2bd67a8a1cae2fe3dcae7803982ec5149493382
|
4
|
+
data.tar.gz: 0c9ea74a41bd0e699816588f0036e49f2628bd034207f7a85c3ba6eb3f94209e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a7c6a45257009851f648568b2d700da25f87f079cfd9d1fc78721af6404225b58cfb63f77938f36b0bc0b6cedf0e132422e2761c23ee8fdfd2f3f6ed2676d6
|
7
|
+
data.tar.gz: 4b0e1430d6da378ad6876409452d4bfec4324d07aa6147e4a2fe5a313e9beaaf99a33c6091c5590a8e0feb44943b1520b1c09509f6b04269d122ac0c725199f0
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -632,14 +632,6 @@ Using hardware with [Intel Quick Sync Video](https://en.wikipedia.org/wiki/Intel
|
|
632
632
|
|
633
633
|
Also, keep in mind that hardware encoders are typically designed for realtime video chat or other similar duties. To maintain that performance, they often take shortcuts with video quality like reducing reference frames, lowering subpixel motion estimation, etc. Such an approach is the equivalent of using the `veryfast` preset with a software encoder. That's fine for video chat but I wouldn't recommend it for transcoding your disc collection.
|
634
634
|
|
635
|
-
### Can you add support for Enhanced AC-3 audio?
|
636
|
-
|
637
|
-
[Dolby Digital Plus](https://en.wikipedia.org/wiki/Dolby_Digital_Plus) or Enhanced AC-3 is a successor to the Dolby Digital AC-3 audio format. AC-3 is the format currently output by `transcode-video` when surround audio is used as input. HandBrake has supported Enhanced AC-3 since version 1.0.0.
|
638
|
-
|
639
|
-
The original AC-3 format is limited to 5.1 audio channels. This means that any 7.1 channel audio track, typically available on Blu-ray Discs, needs to be downmixed during transcoding. The advantage to Enhanced AC-3 is that it can support up to 13.1 audio channels, so no downmixing is necessary.
|
640
|
-
|
641
|
-
Unfortunately, Enhanced AC-3 output is currently limited to 5.1 audio channels in HandBrake. I'll consider adding support once an Enhanced AC-3 feature without that limitation is available.
|
642
|
-
|
643
635
|
### How do you assess video transcoding quality?
|
644
636
|
|
645
637
|
I compare by visual inspection. Always with the video in motion, never frame by frame. It's tedious but after years of practice I know which portions of which videos are problematic and difficult to transcode. And I look at those first.
|
@@ -650,8 +642,6 @@ What I don't use are [peak signal-to-noise ratios](https://en.wikipedia.org/wiki
|
|
650
642
|
|
651
643
|
### What options do you use with `transcode-video`?
|
652
644
|
|
653
|
-
I use the default settings. That's why they're the defaults.
|
654
|
-
|
655
645
|
I never use the `--crop detect` function of `transcode-video` because I don't trust either `HandBrakeCLI` or `ffmpeg` to always get it right without supervision. Instead, I use the separate `detect-crop` tool before transcoding to manually review and apply the best crop values.
|
656
646
|
|
657
647
|
I let `transcode-video` automatically burn any forced subtitles into the output video track when the "forced" flag is enabled in the original.
|
@@ -662,10 +652,27 @@ For a few problematic videos, I have to apply options like `--force-rate 23.976
|
|
662
652
|
|
663
653
|
## History
|
664
654
|
|
665
|
-
|
655
|
+
### [0.19.0](https://github.com/donmelton/video_transcoding/releases/tag/0.19.0)
|
656
|
+
|
657
|
+
Saturday, January 27, 2018
|
658
|
+
|
659
|
+
* Add support for [Dolby Digital Plus](https://en.wikipedia.org/wiki/Dolby_Digital_Plus) audio format, aka Enhanced AC-3, to `transcode-video` and `convert-video` with a new `--ac3-encoder` option for each tool. Also, extend the `--ac3-bitrate` and `--pass-ac3-bitrate` options in `transcode-video` to support higher bitrates, 768 and 1536 Kbps, available to Enhanced AC-3. Via [ #26](https://github.com/donmelton/video_transcoding/issues/26).
|
660
|
+
* WARNING: Dolby Digital Plus output is currently NOT COMPATIBLE with the MP4 file format when using `transcode-video` due to a limitation in `HandBrakeCLI`. This means that adding both `--mp4` and `--ac3-encoder eac3` to your command line will fail with the error "`incompatible encoder 'eac3' for muxer 'av_mp4'`."
|
661
|
+
* Oddly enough, `ffmpeg` doesn't have this limitation so you'll be able to use `convert-video --ac3-encoder eac3` to convert your MKV files into MP4 format without any problems. Go figure.
|
662
|
+
* Remove "Can you add support for Enhanced AC-3 audio?" from the "FAQ" section of the "README" document, for obvious reasons. :)
|
663
|
+
* Add `--reverse-double-order` option to `transcode-video` to reverse order of double-width audio output tracks. Thanks, [@samhutchins](https://github.com/samhutchins)! Via [ #184](https://github.com/donmelton/video_transcoding/pull/184).
|
664
|
+
* Fix a bug in `convert-video` where the number of audio channels was wrong when tracks had to be transcoded. This was most noticeable for AAC output and appears due to a change in the behavior of `ffmpeg`.
|
665
|
+
* Append `.inspect` to all Hash objects used as `Console.debug` arguments. Apparently a change in the way Ruby works was preventing these objects from being printed, although I'm unsure about the specific version of Ruby in which this occurred.
|
666
|
+
* Remove superfluous quotes in the `--help` output of `transcode-video`.
|
667
|
+
* Remove the deprecated `--cvbr` and `--vbr` options in `transcode-video` and `--player` option in `detect-crop`.
|
668
|
+
* Revise my usage in the "FAQ" section of the "README" document since I no longer choose the default settings with `transcode-video`.
|
669
|
+
* Re-order a few misplaced lines in the "History" section of the "README" document.
|
670
|
+
* Update all copyright notices to the year 2018.
|
666
671
|
|
667
672
|
### [0.18.0](https://github.com/donmelton/video_transcoding/releases/tag/0.18.0)
|
668
673
|
|
674
|
+
Saturday, December 2, 2017
|
675
|
+
|
669
676
|
* Improve the average bitrate (ABR) ratecontrol system provided by the `--abr` option in `transcode-video`. Via [ #179](https://github.com/donmelton/video_transcoding/issues/179).
|
670
677
|
* Implement it with a maximum bitrate constraint to raise its overal quality level and guarantee that it will not generate any `VBV underflow` warnings like the default ratecontrol system.
|
671
678
|
* Signal Hypothetical Reference Decoder (HRD) information, meaning that the VBV maximum bitrate value is added as metadata to the output video, something you should _not_ do when using the default ratecontrol system.
|
@@ -679,16 +686,16 @@ Saturday, December 2, 2017
|
|
679
686
|
* Fix failure of subtitle detection for HandBrake nightly builds. Language detection for subtitles in disc image directory input and individual closed caption tracks may still be wrong but will not be fixed at this time. Via [ #172](https://github.com/donmelton/video_transcoding/issues/172).
|
680
687
|
* Mention [Nick Wronski](https://github.com/nwronski)'s nifty batch-processing wrapper for `transcode-video` in the the "README" document. Thanks, [@JMoVS](https://github.com/JMoVS)! Via [ #180](https://github.com/donmelton/video_transcoding/pull/180).
|
681
688
|
|
682
|
-
Sunday, September 10, 2017
|
683
|
-
|
684
689
|
### [0.17.4](https://github.com/donmelton/video_transcoding/releases/tag/0.17.4)
|
685
690
|
|
686
|
-
|
691
|
+
Sunday, September 10, 2017
|
687
692
|
|
688
|
-
|
693
|
+
* Force text output from `mp4track` into UTF-8 binary format to ensure correct parsing of that data. Thanks, [@DavidNielsen](https://github.com/DavidNielsen)! Via [ #152](https://github.com/donmelton/video_transcoding/pull/152).
|
689
694
|
|
690
695
|
### [0.17.3](https://github.com/donmelton/video_transcoding/releases/tag/0.17.3)
|
691
696
|
|
697
|
+
Sunday, May 14, 2017
|
698
|
+
|
692
699
|
* `HandBrakeCLI` versions 1.0 and later changed the default frame rate mode from "constant" to "peak-limited" when a rate is specified. This new behavior in `HandBrakeCLI` requires two significant changes in `transcode-video`:
|
693
700
|
* Fix a bug where the `--force-rate` option failed to force a constant frame rate. This bug made it behave essentially the same at the `--limit-rate` option.
|
694
701
|
* Fix a bug where a constant frame rate was not forced for inputs containing [MPEG-2 video](https://en.wikipedia.org/wiki/MPEG-2). This bug affected the transcoding of all DVDs but very few Blu-ray Discs. The good news is that this bug probably didn't cause visual problems since the new default peak-limited implementation in `HandBrakeCLI` versions 1.0 and later worked like a constant frame rate most of the time.
|
data/bin/convert-video
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# convert-video
|
4
4
|
#
|
5
|
-
# Copyright (c) 2013-
|
5
|
+
# Copyright (c) 2013-2018 Don Melton
|
6
6
|
#
|
7
7
|
|
8
8
|
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
@@ -34,6 +34,8 @@ Usage: #{$PROGRAM_NAME} [OPTION]... [FILE]...
|
|
34
34
|
--use-m4v use `.m4v` extension instead of `.mp4` for MP4 output
|
35
35
|
--no-double don't swap order of first two audio tracks
|
36
36
|
or add stereo copy of main surround track
|
37
|
+
--ac3-encoder ac3|eac3
|
38
|
+
set AC-3 audio encoder (default: ac3)
|
37
39
|
|
38
40
|
-v, --verbose increase diagnostic information
|
39
41
|
-q, --quiet decrease " "
|
@@ -47,15 +49,25 @@ HERE
|
|
47
49
|
|
48
50
|
def initialize
|
49
51
|
super
|
50
|
-
@output
|
51
|
-
@use_m4v
|
52
|
-
@double
|
52
|
+
@output = nil
|
53
|
+
@use_m4v = false
|
54
|
+
@double = true
|
55
|
+
@ac3_encoder = 'ac3'
|
53
56
|
end
|
54
57
|
|
55
58
|
def define_options(opts)
|
56
59
|
opts.on('-o', '--output ARG') { |arg| @output = arg }
|
57
60
|
opts.on('--use-m4v') { @use_m4v = true }
|
58
61
|
opts.on('--no-double') { @double = false }
|
62
|
+
|
63
|
+
opts.on '--ac3-encoder ARG' do |arg|
|
64
|
+
@ac3_encoder = case arg
|
65
|
+
when 'ac3', 'eac3'
|
66
|
+
arg
|
67
|
+
else
|
68
|
+
fail UsageError, "invalid AC-3 audio encoder: #{arg}"
|
69
|
+
end
|
70
|
+
end
|
59
71
|
end
|
60
72
|
|
61
73
|
def configure
|
@@ -72,7 +84,7 @@ HERE
|
|
72
84
|
def process_input(arg)
|
73
85
|
Console.info "Processing: #{arg}..."
|
74
86
|
media = Media.new(path: arg, allow_directory: false)
|
75
|
-
Console.debug media.info
|
87
|
+
Console.debug media.info.inspect
|
76
88
|
output = resolve_output(media)
|
77
89
|
fail "no compatible video track: #{arg}" unless media.info[:h264] or media.info[:hevc]
|
78
90
|
fail "no video stream: #{arg}" unless media.info.has_key? :stream
|
@@ -128,7 +140,7 @@ HERE
|
|
128
140
|
'-map', "0:#{media.info[:audio][1][:stream]}"
|
129
141
|
])
|
130
142
|
copy_options.concat([
|
131
|
-
'-ac', '2',
|
143
|
+
'-ac:a:0', '2',
|
132
144
|
'-c:a:0', FFmpeg.aac_encoder,
|
133
145
|
'-b:a:0', '160k'
|
134
146
|
])
|
@@ -142,17 +154,17 @@ HERE
|
|
142
154
|
])
|
143
155
|
|
144
156
|
if media.info[:audio][track][:channels] > 2.0 and
|
145
|
-
media.info[:audio][track][:format]
|
157
|
+
not ac3_format?(media.info[:audio][track][:format])
|
146
158
|
copy_options.concat([
|
147
|
-
|
148
|
-
"-c:a:#{stream}",
|
159
|
+
"-ac:a:#{stream}", '6',
|
160
|
+
"-c:a:#{stream}", @ac3_encoder,
|
149
161
|
"-b:a:#{stream}", '640k'
|
150
162
|
])
|
151
163
|
elsif media.info[:audio][track][:channels] <= 2.0 and
|
152
164
|
media.info[:audio][track][:format] != 'AAC' and
|
153
|
-
media.info[:audio][track][:format]
|
165
|
+
not ac3_format?(media.info[:audio][track][:format])
|
154
166
|
copy_options.concat([
|
155
|
-
|
167
|
+
"-ac:a:#{stream}", '2',
|
156
168
|
"-c:a:#{stream}", FFmpeg.aac_encoder,
|
157
169
|
"-b:a:#{stream}", '160k'
|
158
170
|
])
|
@@ -206,7 +218,7 @@ HERE
|
|
206
218
|
|
207
219
|
convert media, output, ['-movflags', 'disable_chpl', *map_options, *copy_options]
|
208
220
|
mp4_media = Media.new(path: output, allow_directory: false)
|
209
|
-
Console.debug mp4_media.info
|
221
|
+
Console.debug mp4_media.info.inspect
|
210
222
|
|
211
223
|
last_track = 0
|
212
224
|
|
@@ -236,6 +248,15 @@ HERE
|
|
236
248
|
end
|
237
249
|
end
|
238
250
|
|
251
|
+
def ac3_format?(track_format)
|
252
|
+
if (@ac3_encoder == 'ac3' and track_format == 'AC3') or
|
253
|
+
(@ac3_encoder == 'eac3' and track_format =~ /^(?:E-)?AC3$/)
|
254
|
+
true
|
255
|
+
else
|
256
|
+
false
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
239
260
|
def mp4_track_enable(output, track, enabled)
|
240
261
|
unless enabled.nil?
|
241
262
|
begin
|
@@ -333,7 +354,7 @@ HERE
|
|
333
354
|
|
334
355
|
convert media, output, [*map_options, *copy_options]
|
335
356
|
mkv_media = Media.new(path: output, allow_directory: false)
|
336
|
-
Console.debug mkv_media.info
|
357
|
+
Console.debug mkv_media.info.inspect
|
337
358
|
mkvpropedit_options = [
|
338
359
|
'--tags', 'all:'
|
339
360
|
]
|
@@ -406,7 +427,7 @@ HERE
|
|
406
427
|
*ffmpeg_options,
|
407
428
|
output
|
408
429
|
]
|
409
|
-
Console.debug ffmpeg_command
|
430
|
+
Console.debug ffmpeg_command.inspect
|
410
431
|
Console.info 'Converting with ffmpeg...'
|
411
432
|
|
412
433
|
begin
|
data/bin/detect-crop
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# detect-crop
|
4
4
|
#
|
5
|
-
# Copyright (c) 2013-
|
5
|
+
# Copyright (c) 2013-2018 Don Melton
|
6
6
|
#
|
7
7
|
|
8
8
|
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
@@ -48,7 +48,6 @@ HERE
|
|
48
48
|
@title = nil
|
49
49
|
@constrain = false
|
50
50
|
@values_only = false
|
51
|
-
@player = :mpv
|
52
51
|
end
|
53
52
|
|
54
53
|
def define_options(opts)
|
@@ -56,18 +55,6 @@ HERE
|
|
56
55
|
opts.on('--title ARG', Integer) { |arg| @title = arg }
|
57
56
|
opts.on('--constrain') { @constrain = true }
|
58
57
|
opts.on('--values-only') { @values_only = true }
|
59
|
-
|
60
|
-
opts.on '--player ARG' do |arg|
|
61
|
-
Console.warn '**********'
|
62
|
-
Console.warn 'Using deprecated option: --player'
|
63
|
-
Console.warn '**********'
|
64
|
-
@player = case arg
|
65
|
-
when 'mpv', 'mplayer'
|
66
|
-
arg.to_sym
|
67
|
-
else
|
68
|
-
fail UsageError, "invalid player argument: #{arg}"
|
69
|
-
end
|
70
|
-
end
|
71
58
|
end
|
72
59
|
|
73
60
|
def configure
|
@@ -80,13 +67,13 @@ HERE
|
|
80
67
|
|
81
68
|
if @scan
|
82
69
|
media = Media.new(path: arg, title: @title)
|
83
|
-
Console.debug media.info
|
70
|
+
Console.debug media.info.inspect
|
84
71
|
puts media.summary
|
85
72
|
return
|
86
73
|
end
|
87
74
|
|
88
75
|
media = Media.new(path: arg, title: @title, autocrop: true, extended: false)
|
89
|
-
Console.debug media.info
|
76
|
+
Console.debug media.info.inspect
|
90
77
|
width, height = media.info[:width], media.info[:height]
|
91
78
|
directory = media.info[:directory]
|
92
79
|
hb_crop = media.info[:autocrop]
|
@@ -103,16 +90,8 @@ HERE
|
|
103
90
|
|
104
91
|
print_all = ->(crop) do
|
105
92
|
puts
|
106
|
-
|
107
|
-
|
108
|
-
puts "mpv --no-audio --vf \"lavfi=[drawbox=#{Crop.drawbox_string(crop, width, height)}:invert:1]\" #{shell_path}"
|
109
|
-
puts "mpv --no-audio --vf crop=#{Crop.player_string(crop, width, height)} #{shell_path}"
|
110
|
-
else
|
111
|
-
str = Crop.player_string(crop, width, height)
|
112
|
-
puts "mplayer -really-quiet -nosound -vf rectangle=#{str} #{shell_path}"
|
113
|
-
puts "mplayer -really-quiet -nosound -vf crop=#{str} #{shell_path}"
|
114
|
-
end
|
115
|
-
|
93
|
+
puts "mpv --no-audio --vf \"lavfi=[drawbox=#{Crop.drawbox_string(crop, width, height)}:invert:1]\" #{shell_path}"
|
94
|
+
puts "mpv --no-audio --vf crop=#{Crop.player_string(crop, width, height)} #{shell_path}"
|
116
95
|
print_transcode.call crop
|
117
96
|
end
|
118
97
|
|
data/bin/query-handbrake-log
CHANGED
data/bin/transcode-video
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# transcode-video
|
4
4
|
#
|
5
|
-
# Copyright (c) 2013-
|
5
|
+
# Copyright (c) 2013-2018 Don Melton
|
6
6
|
#
|
7
7
|
|
8
8
|
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
@@ -109,7 +109,7 @@ Audio options:
|
|
109
109
|
(default: first track, i.e. 1)
|
110
110
|
(language code must be ISO 639-2 format, e.g.: `eng`)
|
111
111
|
(default output can be two audio tracks,
|
112
|
-
both surround and stereo, i.e.
|
112
|
+
both surround and stereo, i.e. width is `double`)
|
113
113
|
--add-audio TRACK[=NAME]|LANGUAGE[,LANGUAGE,...]|all
|
114
114
|
add track selected by number assigning it an optional name
|
115
115
|
or add tracks selected with one or more language codes
|
@@ -117,21 +117,25 @@ Audio options:
|
|
117
117
|
(language code must be ISO 639-2 format, e.g.: `eng`)
|
118
118
|
(multiple languages are separated by commas)
|
119
119
|
(default output is single AAC audio track,
|
120
|
-
i.e.
|
120
|
+
i.e. width is `stereo`)
|
121
121
|
(can be used multiple times)
|
122
122
|
--audio-width TRACK|main|other|all=double|surround|stereo
|
123
|
-
set audio output
|
123
|
+
set audio output width for specific track by number
|
124
124
|
or main track or other non-main tracks or all tracks
|
125
125
|
with `double` to allow room for two output tracks
|
126
126
|
with `surround` to allow single surround or stereo track
|
127
127
|
with `stereo` to allow only single stereo track
|
128
128
|
(can be used multiple times)
|
129
|
+
--reverse-double-order
|
130
|
+
reverse order of `double` width audio output tracks
|
129
131
|
--prefer-ac3 prefer AC-3 over AAC format when encoding or copying audio
|
130
132
|
even when original track channel layout is stereo or mono
|
131
|
-
(sets audio output
|
132
|
-
--ac3-
|
133
|
+
(sets audio output width for all tracks to `surround`)
|
134
|
+
--ac3-encoder ac3|eac3
|
135
|
+
set AC-3 audio encoder (default: ac3)
|
136
|
+
--ac3-bitrate 384|448|640|768|1536
|
133
137
|
set AC-3 audio bitrate (default: 640)
|
134
|
-
--pass-ac3-bitrate 384|448|640
|
138
|
+
--pass-ac3-bitrate 384|448|640|768|1536
|
135
139
|
set AC-3 audio pass-through bitrate (default: 640)
|
136
140
|
--copy-audio TRACK|all
|
137
141
|
try to copy track selected by number in its original format
|
@@ -241,7 +245,9 @@ HERE
|
|
241
245
|
@audio_name = {}
|
242
246
|
@audio_language = []
|
243
247
|
@audio_width = {:main => :double, :other => :stereo}
|
248
|
+
@reverse_double_order = false
|
244
249
|
@prefer_ac3 = false
|
250
|
+
@ac3_encoder = 'ac3'
|
245
251
|
@ac3_bitrate = 640
|
246
252
|
@pass_ac3_bitrate = 640
|
247
253
|
@copy_audio = []
|
@@ -532,15 +538,26 @@ HERE
|
|
532
538
|
end
|
533
539
|
end
|
534
540
|
|
541
|
+
opts.on('--reverse-double-order') { @reverse_double_order = true }
|
542
|
+
|
535
543
|
opts.on '--prefer-ac3' do
|
536
544
|
@prefer_ac3 = true
|
537
545
|
@audio_width[:main] = :surround
|
538
546
|
@audio_width[:other] = :surround
|
539
547
|
end
|
540
548
|
|
549
|
+
opts.on '--ac3-encoder ARG' do |arg|
|
550
|
+
@ac3_encoder = case arg
|
551
|
+
when 'ac3', 'eac3'
|
552
|
+
arg
|
553
|
+
else
|
554
|
+
fail UsageError, "invalid AC-3 audio encoder: #{arg}"
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
541
558
|
opts.on '--ac3-bitrate ARG', Integer do |arg|
|
542
559
|
@ac3_bitrate = case arg
|
543
|
-
when 384, 448, 640
|
560
|
+
when 384, 448, 640, 768, 1536
|
544
561
|
arg
|
545
562
|
else
|
546
563
|
fail UsageError, "unsupported AC-3 audio bitrate: #{arg}"
|
@@ -549,7 +566,7 @@ HERE
|
|
549
566
|
|
550
567
|
opts.on '--pass-ac3-bitrate ARG', Integer do |arg|
|
551
568
|
@pass_ac3_bitrate = case arg
|
552
|
-
when 384, 448, 640
|
569
|
+
when 384, 448, 640, 768, 1536
|
553
570
|
arg
|
554
571
|
else
|
555
572
|
fail UsageError, "unsupported AC-3 audio pass-through bitrate: #{arg}"
|
@@ -720,30 +737,6 @@ HERE
|
|
720
737
|
fail UsageError, "invalid HandBrakeCLI option: #{arg}"
|
721
738
|
end
|
722
739
|
end
|
723
|
-
|
724
|
-
opts.on '--cvbr' do
|
725
|
-
Console.warn '**********'
|
726
|
-
Console.warn 'Using deprecated option: --cvbr'
|
727
|
-
Console.warn 'Replace with: -E crf-max=30 -E _qpmax'
|
728
|
-
Console.warn '**********'
|
729
|
-
@encoder_options['crf-max'] = '30'
|
730
|
-
@disable_encoder_options << 'qpmax'
|
731
|
-
@use_abr = false
|
732
|
-
end
|
733
|
-
|
734
|
-
opts.on '--vbr ARG', Float do |arg|
|
735
|
-
crf = arg.to_s.gsub(/\.0+$/, '')
|
736
|
-
Console.warn '**********'
|
737
|
-
Console.warn 'Using deprecated option: --vbr'
|
738
|
-
Console.warn "Replace with: -H quality=#{crf} -E _vbv-maxrate -E _vbv-bufsize -E _crf-max -E _qpmax"
|
739
|
-
Console.warn '**********'
|
740
|
-
@handbrake_options['quality'] = crf
|
741
|
-
@disable_encoder_options << 'vbv-maxrate'
|
742
|
-
@disable_encoder_options << 'vbv-bufsize'
|
743
|
-
@disable_encoder_options << 'crf-max'
|
744
|
-
@disable_encoder_options << 'qpmax'
|
745
|
-
@use_abr = false
|
746
|
-
end
|
747
740
|
end
|
748
741
|
|
749
742
|
def force_handbrake_option(name, value)
|
@@ -798,14 +791,14 @@ HERE
|
|
798
791
|
|
799
792
|
if @scan
|
800
793
|
media = Media.new(path: arg, title: @title)
|
801
|
-
Console.debug media.info
|
794
|
+
Console.debug media.info.inspect
|
802
795
|
puts media.summary
|
803
796
|
return
|
804
797
|
end
|
805
798
|
|
806
799
|
seconds = Time.now.tv_sec
|
807
800
|
media = Media.new(path: arg, title: @title, autocrop: @crop == :detect)
|
808
|
-
Console.debug media.info
|
801
|
+
Console.debug media.info.inspect
|
809
802
|
handbrake_options = {
|
810
803
|
'input' => arg,
|
811
804
|
'output' => resolve_output(media),
|
@@ -1056,13 +1049,17 @@ HERE
|
|
1056
1049
|
add_surround = ->(info, copy) do
|
1057
1050
|
bitrate = info[:bps].nil? ? 640 : info[:bps] / 1000
|
1058
1051
|
|
1059
|
-
if
|
1052
|
+
if copy or
|
1053
|
+
(((@ac3_encoder == 'ac3' and info[:format] == 'AC3') or
|
1054
|
+
(@ac3_encoder == 'eac3' and info[:format] =~ /^(?:E-)?AC3$/)) and
|
1055
|
+
bitrate <= @pass_ac3_bitrate)
|
1060
1056
|
encoders << 'copy'
|
1061
1057
|
bitrates << ''
|
1062
1058
|
else
|
1063
|
-
encoders <<
|
1059
|
+
encoders << @ac3_encoder
|
1064
1060
|
|
1065
|
-
if @ac3_bitrate
|
1061
|
+
if (@ac3_encoder == 'ac3' and @ac3_bitrate >= 640) or
|
1062
|
+
(@ac3_encoder == 'eac3' and @ac3_bitrate == 1536)
|
1066
1063
|
bitrates << ''
|
1067
1064
|
else
|
1068
1065
|
bitrates << @ac3_bitrate.to_s
|
@@ -1108,7 +1105,7 @@ HERE
|
|
1108
1105
|
tracks << track
|
1109
1106
|
names << name
|
1110
1107
|
|
1111
|
-
if @format == :mkv
|
1108
|
+
if @format == :mkv ? !@reverse_double_order : @reverse_double_order
|
1112
1109
|
add_surround.call info, copy
|
1113
1110
|
add_stereo.call info, false
|
1114
1111
|
else
|
@@ -1131,7 +1128,7 @@ HERE
|
|
1131
1128
|
|
1132
1129
|
handbrake_options['audio'] = tracks.join(',')
|
1133
1130
|
handbrake_options['aencoder'] = encoders.join(',')
|
1134
|
-
handbrake_options['audio-fallback'] =
|
1131
|
+
handbrake_options['audio-fallback'] = @ac3_encoder unless @copy_audio.empty?
|
1135
1132
|
bitrates = bitrates.join(',')
|
1136
1133
|
handbrake_options['ab'] = bitrates if bitrates.gsub(/,/, '') != ''
|
1137
1134
|
names = names.join(',')
|
@@ -1279,7 +1276,7 @@ HERE
|
|
1279
1276
|
return
|
1280
1277
|
end
|
1281
1278
|
|
1282
|
-
Console.debug handbrake_command
|
1279
|
+
Console.debug handbrake_command.inspect
|
1283
1280
|
log_file = @log ? File.new(handbrake_options['output'] + '.log', 'wb') : nil
|
1284
1281
|
Console.info 'Transcoding with HandBrakeCLI...'
|
1285
1282
|
|
@@ -1305,7 +1302,7 @@ HERE
|
|
1305
1302
|
def adjust_metadata(output, renamed_audio)
|
1306
1303
|
return if @dry_run
|
1307
1304
|
media = Media.new(path: output, allow_directory: false)
|
1308
|
-
Console.debug media.info
|
1305
|
+
Console.debug media.info.inspect
|
1309
1306
|
|
1310
1307
|
if media.info[:mkv] and
|
1311
1308
|
media.info[:subtitle].include? 1 and
|
data/lib/video_transcoding.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video_transcoding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Melton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Video Transcoding is a package of tools to transcode, inspect
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.7.4
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Tools to transcode, inspect and convert videos.
|