video_transcoding 0.23.0 → 0.24.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 +4 -4
- data/README.md +16 -0
- data/bin/query-handbrake-log +1 -1
- data/bin/transcode-video +79 -24
- data/lib/video_transcoding/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18cb27202f7ca6e7c2c06000235622d7f30ab398dc9e7da2d35961a079a11ba0
|
4
|
+
data.tar.gz: fcc91ae647be367d93f9bc7a9ecf317cb7f72e15c7da4880a4c2db48927bb959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0c7a36b0e17efd6fb3a18bd9f36a5dd61b4e20fab78a9b46e2a5a317af2c4437db831e39efd74e6ef5a6fbccbf68d673d0dc30f344a625f1d615d445be4581
|
7
|
+
data.tar.gz: 4e32e4f2141b38c31db2a360b8f99149dda65f5942a16096cb64d08585634f86be7dca8bdbf5e46640af755baa58210f2e9d4f92dd30c3d4d4c59f784b1d9339
|
data/README.md
CHANGED
@@ -676,6 +676,22 @@ For a few problematic videos, I have to apply options like `--force-rate 23.976
|
|
676
676
|
|
677
677
|
## History
|
678
678
|
|
679
|
+
### [0.24.0](https://github.com/donmelton/video_transcoding/releases/tag/0.24.0)
|
680
|
+
|
681
|
+
Sunday, February 24, 2019
|
682
|
+
|
683
|
+
* Add `--audio-format` and `--keep-ac3-stereo` options to `transcode-video`. Thanks to [@samhutchins](https://github.com/samhutchins) for the idea and design! Via [ #254](https://github.com/donmelton/video_transcoding/issues/254).
|
684
|
+
* With the `--audio-format` option, you can now specify whether AC-3 or AAC is used when surround or stereo output tracks are created.
|
685
|
+
* This allows multichannel 5.1 AAC audio output by adding `--audio-format surround=aac` to your command line. However, you may want to pair that with `--audio-width main=surround` to avoid two AAC tracks of the same input being created.
|
686
|
+
* Think of the `--keep-ac3-stereo` option as a kinder, gentler form of the `--prefer-ac3` option.
|
687
|
+
* It copies rather than transcodes AC-3 stereo or mono audio tracks even when the current stereo format is AAC, but it doesn't affect surround tracks.
|
688
|
+
* Deprecate the `--prefer-ac3` option in `transcode-video` and remove its description from the `--help` output. Also via [ #254](https://github.com/donmelton/video_transcoding/issues/254).
|
689
|
+
* The option still works for now, but using it issues a warning message.
|
690
|
+
* You can get the exact same functionality by adding `--audio-width all=surround --audio-format all=ac3` to your command line.
|
691
|
+
* However, you might want to add `--audio-width all=surround --keep-ac3-stereo` instead since you'll get higher quality and slightly smaller output, albeit with some AAC tracks in your output when stereo audio in non-AC-3 format still needs to be transcoded.
|
692
|
+
* Add a `minimal` argument to the `--fallback-crop` option in `transcode-video` which determines the smallest possible crop values, when using the`--crop detect` option and argument, by combining results from both `HandBrakeCLI` and `ffmpeg`. Thanks to [@dkoenig01](https://github.com/dkoenig01) for the idea! Via [ #255](https://github.com/donmelton/video_transcoding/issues/255).
|
693
|
+
* Relax validation criteria for HandBrake-generated `.log` files in `query-handbrake-log` as workaround for `HandBrakeCLI` spewing linkage failure warnings on certain Linux platforms. Via [ #257](https://github.com/donmelton/video_transcoding/issues/257).
|
694
|
+
|
679
695
|
### [0.23.0](https://github.com/donmelton/video_transcoding/releases/tag/0.23.0)
|
680
696
|
|
681
697
|
Sunday, February 10, 2019
|
data/bin/query-handbrake-log
CHANGED
@@ -137,7 +137,7 @@ HERE
|
|
137
137
|
File.foreach(log) do |line|
|
138
138
|
found = true if not found and line =~ /^HandBrake/
|
139
139
|
count += 1
|
140
|
-
fail "not a HandBrake-generated `.log` file: #{log}" if count >
|
140
|
+
fail "not a HandBrake-generated `.log` file: #{log}" if count > 10 and not found
|
141
141
|
duration_line = line if duration_line.nil? and line =~ /\+ duration: /
|
142
142
|
rate_line = line if line =~ /\+ frame rate: /
|
143
143
|
|
data/bin/transcode-video
CHANGED
@@ -89,8 +89,10 @@ Video options:
|
|
89
89
|
(use `--crop auto` for `HandBrakeCLI` behavior)
|
90
90
|
--constrain-crop
|
91
91
|
constrain `--crop detect` to optimal shape
|
92
|
-
--fallback-crop handbrake|ffmpeg|none
|
92
|
+
--fallback-crop handbrake|ffmpeg|minimal|none
|
93
93
|
select fallback crop values if `--crop detect` fails
|
94
|
+
(`minimal` uses the smallest possible crop values
|
95
|
+
combining results from `HandBrakeCLI` and `ffmpeg`)
|
94
96
|
--720p fit video within 1280x720 pixel bounds
|
95
97
|
--max-width WIDTH, --max-height HEIGHT
|
96
98
|
fit video within horizontal and/or vertical pixel bounds
|
@@ -134,9 +136,12 @@ Audio options:
|
|
134
136
|
(can be used multiple times)
|
135
137
|
--reverse-double-order
|
136
138
|
reverse order of `double` width audio output tracks
|
137
|
-
--
|
138
|
-
|
139
|
-
(
|
139
|
+
--audio-format surround|stereo|all=ac3|aac
|
140
|
+
set audio format for specific or all output tracks
|
141
|
+
(default for surround: ac3; default for stereo: aac)
|
142
|
+
--keep-ac3-stereo
|
143
|
+
copy rather than transcode AC-3 stereo or mono audio tracks
|
144
|
+
even when the current stereo format is AAC
|
140
145
|
--ac3-encoder ac3|eac3
|
141
146
|
set AC-3 audio encoder (default: ac3)
|
142
147
|
--ac3-bitrate 384|448|640|768|1536
|
@@ -145,7 +150,7 @@ Audio options:
|
|
145
150
|
set AC-3 audio pass-through bitrate (default: 640)
|
146
151
|
--copy-audio TRACK|all
|
147
152
|
try to copy track selected by number in its original format
|
148
|
-
falling back to
|
153
|
+
falling back to surround format if original not allowed
|
149
154
|
or try to copy all tracks in same manner
|
150
155
|
(only applies to main and explicitly added audio tracks)
|
151
156
|
(can be used multiple times)
|
@@ -253,7 +258,9 @@ HERE
|
|
253
258
|
@audio_language = []
|
254
259
|
@audio_width = {:main => :double, :other => :stereo}
|
255
260
|
@reverse_double_order = false
|
256
|
-
@
|
261
|
+
@surround_format = 'ac3'
|
262
|
+
@stereo_format = 'aac'
|
263
|
+
@keep_ac3_stereo = false
|
257
264
|
@ac3_encoder = 'ac3'
|
258
265
|
@ac3_bitrate = 640
|
259
266
|
@pass_ac3_bitrate = 640
|
@@ -430,7 +437,7 @@ HERE
|
|
430
437
|
|
431
438
|
opts.on '--fallback-crop ARG' do |arg|
|
432
439
|
@fallback_crop = case arg
|
433
|
-
when 'handbrake', 'ffmpeg', 'mplayer', 'none'
|
440
|
+
when 'handbrake', 'ffmpeg', 'mplayer', 'minimal', 'none'
|
434
441
|
arg.to_sym
|
435
442
|
else
|
436
443
|
fail UsageError, "invalid fallback crop argument: #{arg}"
|
@@ -557,10 +564,35 @@ HERE
|
|
557
564
|
|
558
565
|
opts.on('--reverse-double-order') { @reverse_double_order = true }
|
559
566
|
|
567
|
+
opts.on '--audio-format ARG' do |arg|
|
568
|
+
if arg =~ /^(surround|stereo|all)=(ac3|aac)$/
|
569
|
+
case $1
|
570
|
+
when 'surround'
|
571
|
+
@surround_format = $2
|
572
|
+
when 'stereo'
|
573
|
+
@stereo_format = $2
|
574
|
+
else
|
575
|
+
@surround_format = $2
|
576
|
+
@stereo_format = $2
|
577
|
+
end
|
578
|
+
else
|
579
|
+
fail UsageError, "invalid audio format argument: #{arg}"
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
opts.on '--keep-ac3-stereo' do
|
584
|
+
@keep_ac3_stereo = true
|
585
|
+
end
|
586
|
+
|
560
587
|
opts.on '--prefer-ac3' do
|
561
|
-
|
588
|
+
Console.warn '**********'
|
589
|
+
Console.warn 'Using deprecated option: --prefer-ac3'
|
590
|
+
Console.warn "Replace with: --audio-width all=surround --audio-format all=ac3"
|
591
|
+
Console.warn '**********'
|
562
592
|
@audio_width[:main] = :surround
|
563
593
|
@audio_width[:other] = :surround
|
594
|
+
@surround_format = 'ac3'
|
595
|
+
@stereo_format = 'ac3'
|
564
596
|
end
|
565
597
|
|
566
598
|
opts.on '--ac3-encoder ARG' do |arg|
|
@@ -1053,6 +1085,13 @@ HERE
|
|
1053
1085
|
hb_crop
|
1054
1086
|
when :ffmpeg, :mplayer
|
1055
1087
|
ff_crop
|
1088
|
+
when :minimal
|
1089
|
+
{
|
1090
|
+
:top => [hb_crop[:top], ff_crop[:top]].min,
|
1091
|
+
:bottom => [hb_crop[:bottom], ff_crop[:bottom]].min,
|
1092
|
+
:left => [hb_crop[:left], ff_crop[:left]].min,
|
1093
|
+
:right => [hb_crop[:right], ff_crop[:right]].min
|
1094
|
+
}
|
1056
1095
|
when :none
|
1057
1096
|
{:top => 0, :bottom => 0, :left => 0, :right => 0}
|
1058
1097
|
else
|
@@ -1094,37 +1133,53 @@ HERE
|
|
1094
1133
|
end
|
1095
1134
|
|
1096
1135
|
tracks, encoders, bitrates, mixdowns, names = [], [], [], [], []
|
1136
|
+
@aac_encoder ||= HandBrake.aac_encoder
|
1137
|
+
surround_encoder = @surround_format == 'ac3' ? @ac3_encoder : @aac_encoder
|
1138
|
+
stereo_encoder = @stereo_format == 'ac3' ? @ac3_encoder : @aac_encoder
|
1097
1139
|
|
1098
1140
|
add_surround = ->(info, copy) do
|
1141
|
+
has_ac3 = (@ac3_encoder == 'ac3' and info[:format] == 'AC3') or
|
1142
|
+
(@ac3_encoder == 'eac3' and info[:format] =~ /^(?:E-)?AC3$/)
|
1099
1143
|
bitrate = info[:bps].nil? ? 640 : info[:bps] / 1000
|
1100
1144
|
|
1101
|
-
if
|
1102
|
-
(
|
1103
|
-
|
1104
|
-
bitrate <= @pass_ac3_bitrate)
|
1145
|
+
if copy or
|
1146
|
+
(@surround_format == 'ac3' and has_ac3 and bitrate <= @pass_ac3_bitrate) or
|
1147
|
+
(@surround_format == 'aac' and info[:format] =~ /^AAC/)
|
1105
1148
|
encoders << 'copy'
|
1106
1149
|
bitrates << ''
|
1150
|
+
mixdowns << ''
|
1107
1151
|
else
|
1108
|
-
encoders <<
|
1152
|
+
encoders << surround_encoder
|
1109
1153
|
|
1110
|
-
if
|
1111
|
-
|
1112
|
-
|
1154
|
+
if @surround_format == 'ac3'
|
1155
|
+
if (@ac3_encoder == 'ac3' and @ac3_bitrate >= 640) or
|
1156
|
+
(@ac3_encoder == 'eac3' and @ac3_bitrate == 1536)
|
1157
|
+
bitrates << ''
|
1158
|
+
else
|
1159
|
+
bitrates << @ac3_bitrate.to_s
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
mixdowns << ''
|
1113
1163
|
else
|
1114
|
-
bitrates <<
|
1164
|
+
bitrates << ''
|
1165
|
+
mixdowns << '5point1'
|
1115
1166
|
end
|
1116
1167
|
end
|
1117
|
-
|
1118
|
-
mixdowns << ''
|
1119
1168
|
end
|
1120
1169
|
|
1121
1170
|
add_stereo = ->(info, copy) do
|
1122
|
-
|
1171
|
+
has_ac3 = (@ac3_encoder == 'ac3' and info[:format] == 'AC3') or
|
1172
|
+
(@ac3_encoder == 'eac3' and info[:format] =~ /^(?:E-)?AC3$/)
|
1173
|
+
|
1174
|
+
if copy or
|
1175
|
+
(info[:channels] <= 2.0 and
|
1176
|
+
((@stereo_format == 'aac' and
|
1177
|
+
(info[:format] =~ /^AAC/ or (@keep_ac3_stereo and has_ac3))) or
|
1178
|
+
(@stereo_format == 'ac3' and has_ac3)))
|
1123
1179
|
encoders << 'copy'
|
1124
1180
|
mixdowns << ''
|
1125
1181
|
else
|
1126
|
-
|
1127
|
-
encoders << @aac_encoder
|
1182
|
+
encoders << stereo_encoder
|
1128
1183
|
mixdowns << (info[:channels] > 2.0 ? @mixdown : '')
|
1129
1184
|
end
|
1130
1185
|
|
@@ -1162,7 +1217,7 @@ HERE
|
|
1162
1217
|
add_stereo.call info, copy
|
1163
1218
|
end
|
1164
1219
|
when :surround
|
1165
|
-
if
|
1220
|
+
if (info[:channels] > 2.0)
|
1166
1221
|
add_surround.call info, copy
|
1167
1222
|
else
|
1168
1223
|
add_stereo.call info, copy
|
@@ -1175,7 +1230,7 @@ HERE
|
|
1175
1230
|
handbrake_options['audio'] = tracks.join(',')
|
1176
1231
|
encoders = encoders.join(',')
|
1177
1232
|
handbrake_options['aencoder'] = encoders if encoders.gsub(/,/, '') != ''
|
1178
|
-
handbrake_options['audio-fallback'] =
|
1233
|
+
handbrake_options['audio-fallback'] = surround_encoder unless @copy_audio.empty?
|
1179
1234
|
bitrates = bitrates.join(',')
|
1180
1235
|
handbrake_options['ab'] = bitrates if bitrates.gsub(/,/, '') != ''
|
1181
1236
|
mixdowns = mixdowns.join(',')
|
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.24.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: 2019-02-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Video Transcoding is a package of tools to transcode, inspect
|