video_transcoding 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -7
- data/bin/convert-video +1 -1
- data/bin/detect-crop +0 -5
- data/bin/transcode-video +56 -50
- data/lib/video_transcoding/media.rb +3 -0
- data/lib/video_transcoding/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a766c53d54b741cc24e1d9ba31579667f8354ce1
|
4
|
+
data.tar.gz: d37b0b0730d5e7800aa7795f4a5caf90c84fbbcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fffe7dc4bc59256425bb7fe704033f49fe4b733a49db896a6f1b5274a3e71f5deb85add04bf1976a51aa2f082f9fdd46561096d52c8931e0b9c1e3927ac8e791
|
7
|
+
data.tar.gz: d36bcf4a8ba96c4d7f17519c72af2fb3ea934e28ea8d46d94ed8f0ad3b445d7ba1624f26dfb550fe8aeb4194429a137d35faaa420f392a64211773512a2ff002
|
data/README.md
CHANGED
@@ -80,9 +80,9 @@ On macOS, `HandBrakeCLI` and all its other dependencies can be easily installed
|
|
80
80
|
|
81
81
|
On Linux, package management systems vary so it's best consult the indexes for those systems. But there's a Homebrew port available called [Linuxbrew](http://linuxbrew.sh/) and it doesn't require root access.
|
82
82
|
|
83
|
-
On Windows, it's best to
|
83
|
+
On Windows, it's best to follow one of the two methods, manually installing binaries or installing into the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux), as described here:
|
84
84
|
|
85
|
-
<https://
|
85
|
+
<https://github.com/JMoVS/installing_video_transcoding_on_windows>
|
86
86
|
|
87
87
|
When installing `HandBrakeCLI` or other downloaded programs, make sure the executable binary is in a directory listed in your `PATH` environment variable. On Unix-style systems like macOS and Linux, that directory might be `/usr/local/bin`.
|
88
88
|
|
@@ -198,13 +198,11 @@ The `.m4v` file extension is more "iTunes-friendly," but the file content itself
|
|
198
198
|
|
199
199
|
#### Improving performance
|
200
200
|
|
201
|
-
|
201
|
+
You can increase encoding speed by 70-80% with no easily perceptible loss in video quality by using the `--quick` option:
|
202
202
|
|
203
203
|
transcode-video --quick "/path/to/Movie.mkv"
|
204
204
|
|
205
|
-
The `--quick` option
|
206
|
-
|
207
|
-
Be aware that output files are slightly larger when using the `--quick` option since the loss of precision is also a loss of efficiency.
|
205
|
+
The `--quick` option avoids the typical quality problems associated with the x264 video encoder's speed-based presets, especially as that speed increases.
|
208
206
|
|
209
207
|
#### Cropping
|
210
208
|
|
@@ -612,7 +610,7 @@ Plus, I wouldn't use a GUI for these tasks. And it's a bad idea to develop softw
|
|
612
610
|
|
613
611
|
[High Efficiency Video Coding](https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding) or H.265 is the likely successor to [H.264](https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC), which is the format currently output by `transcode-video`. HandBrake has supported H.265 ever since it included the [x265 video encoder](http://x265.org/).
|
614
612
|
|
615
|
-
My ratecontrol system
|
613
|
+
My ratecontrol system couldn't be applied with the x265 encoder in older versions of HandBrake because it didn't allow access to `qpmax`, critical for maintaining quality in certain situations. The latest version of HandBrake includes a new encoder which fixes that.
|
616
614
|
|
617
615
|
But support also requires equivalent quality at a smaller size when using my rate control system. And performance is an issue. While speed continues to improve, the x265 encoder is still considerably slower than the current H.264 system.
|
618
616
|
|
@@ -658,6 +656,19 @@ For a few problematic videos, I have to apply options like `--force-rate 23.976
|
|
658
656
|
|
659
657
|
## History
|
660
658
|
|
659
|
+
### [0.16.0](https://github.com/donmelton/video_transcoding/releases/tag/0.16.0)
|
660
|
+
|
661
|
+
Friday, January 20, 2017
|
662
|
+
|
663
|
+
* Add a `--cvbr` option to `transcode-video`. This is essentially the same as the experimental option of the same name which was removed on February 25, 2016, but now it doesn't have a bitrate argument. It enables a _simple_ constrained variable bitrate (CVBR) ratecontrol system, less constrained the default, producing a more predictable output size while avoiding `VBV underflow` warnings. Use it with `--target big` for the best results.
|
664
|
+
* Modify the `--abr` option in `transcode-video` to no longer use a bitrate argument. Instead, it relies on the `--target` option to control bitrate, just like the default ratecontrol system and the new `--cvbr` option. So, passing a bitrate argument is now an error. But you should consider using `--cvbr` instead of `--abr` anyway since the former is almost always higher quality.
|
665
|
+
* Remove the deprecated `--no-constrain` option from `detect-crop` and the `--no-constrain-crop` option from `transcode-video`.
|
666
|
+
* Modify `convert-video` to allow HEVC format video along with H.264.
|
667
|
+
* Update the "README" document to:
|
668
|
+
* Revise and simplify the Windows installation instructions to point users at the fine work by [@samhutchins](https://github.com/samhutchins) and [@JMoVS](https://github.com/JMoVS) on documenting their two methods. Via [ #115](https://github.com/donmelton/video_transcoding/issues/115).
|
669
|
+
* Revise the "Using `transcode-video`" section to correct out-of-date performance data about the `--quick` option.
|
670
|
+
* Revise the H.265 answer in the "FAQ" section with up-to-date information about the x265 video encoder. Via [ #118](https://github.com/donmelton/video_transcoding/pull/118).
|
671
|
+
|
661
672
|
### [0.15.0](https://github.com/donmelton/video_transcoding/releases/tag/0.15.0)
|
662
673
|
|
663
674
|
Sunday, January 15, 2017
|
data/bin/convert-video
CHANGED
@@ -74,7 +74,7 @@ HERE
|
|
74
74
|
media = Media.new(path: arg, allow_directory: false)
|
75
75
|
Console.debug media.info
|
76
76
|
output = resolve_output(media)
|
77
|
-
fail "no
|
77
|
+
fail "no compatible video track: #{arg}" unless media.info[:h264] or media.info[:hevc]
|
78
78
|
fail "no video stream: #{arg}" unless media.info.has_key? :stream
|
79
79
|
|
80
80
|
if media.info[:mkv]
|
data/bin/detect-crop
CHANGED
@@ -55,11 +55,6 @@ HERE
|
|
55
55
|
opts.on('--title ARG', Integer) { |arg| @title = arg }
|
56
56
|
opts.on('--constrain') { @constrain = true }
|
57
57
|
opts.on('--values-only') { @values_only = true }
|
58
|
-
|
59
|
-
opts.on '--no-constrain' do
|
60
|
-
Console.warn 'Using deprecated option: --no-constrain'
|
61
|
-
@constrain = false
|
62
|
-
end
|
63
58
|
end
|
64
59
|
|
65
60
|
def configure
|
data/bin/transcode-video
CHANGED
@@ -186,8 +186,11 @@ External subtitle options:
|
|
186
186
|
(can be used multiple times)
|
187
187
|
|
188
188
|
Advanced options:
|
189
|
-
--
|
190
|
-
(more predictable size
|
189
|
+
--cvbr use simple constrained variable bitrate (CVBR) ratecontrol
|
190
|
+
(more predictable size while avoiding VBV underflows)
|
191
|
+
(use with `--target big` for best results)
|
192
|
+
--abr use modified average bitrate (ABR) ratecontrol
|
193
|
+
(predictable size but lower quality than default)
|
191
194
|
--vbr QUALITY use true VBR ratecontrol at constant video quality (0-51)
|
192
195
|
(unpredictable size but useful for comparison to default)
|
193
196
|
-E, --encoder-option NAME=VALUE|_NAME
|
@@ -226,10 +229,10 @@ HERE
|
|
226
229
|
@format = :mkv
|
227
230
|
@log = true
|
228
231
|
@dry_run = false
|
229
|
-
@
|
230
|
-
@
|
231
|
-
@
|
232
|
-
@
|
232
|
+
@max_bitrate_2160p = 12000
|
233
|
+
@max_bitrate_1080p = 6000
|
234
|
+
@max_bitrate_720p = 3000
|
235
|
+
@max_bitrate_480p = 1500
|
233
236
|
@quick = false
|
234
237
|
@veryquick = false
|
235
238
|
@crop = {:top => 0, :bottom => 0, :left => 0, :right => 0}
|
@@ -259,7 +262,8 @@ HERE
|
|
259
262
|
@srt_language = {}
|
260
263
|
@srt_encoding = {}
|
261
264
|
@srt_offset = {}
|
262
|
-
@
|
265
|
+
@use_cvbr = false
|
266
|
+
@use_abr = false
|
263
267
|
@vbr_quality = nil
|
264
268
|
@encoder_options = {}
|
265
269
|
@disable_encoder_options = []
|
@@ -318,27 +322,27 @@ HERE
|
|
318
322
|
opts.on '--target ARG' do |arg|
|
319
323
|
case arg
|
320
324
|
when 'big'
|
321
|
-
@
|
322
|
-
@
|
323
|
-
@
|
324
|
-
@
|
325
|
+
@max_bitrate_2160p = 16000
|
326
|
+
@max_bitrate_1080p = 8000
|
327
|
+
@max_bitrate_720p = 4000
|
328
|
+
@max_bitrate_480p = 2000
|
325
329
|
when 'small'
|
326
|
-
@
|
327
|
-
@
|
328
|
-
@
|
329
|
-
@
|
330
|
+
@max_bitrate_2160p = 8000
|
331
|
+
@max_bitrate_1080p = 4000
|
332
|
+
@max_bitrate_720p = 2000
|
333
|
+
@max_bitrate_480p = 1000
|
330
334
|
when /^([0-9]+p)=([1-9][0-9]*)$/
|
331
335
|
bitrate = $2.to_i
|
332
336
|
|
333
337
|
case $1
|
334
338
|
when '2160p'
|
335
|
-
@
|
339
|
+
@max_bitrate_2160p = bitrate
|
336
340
|
when '1080p'
|
337
|
-
@
|
341
|
+
@max_bitrate_1080p = bitrate
|
338
342
|
when '720p'
|
339
|
-
@
|
343
|
+
@max_bitrate_720p = bitrate
|
340
344
|
when '480p'
|
341
|
-
@
|
345
|
+
@max_bitrate_480p = bitrate
|
342
346
|
else
|
343
347
|
fail UsageError, "invalid target video bitrate resolution: #{$1}"
|
344
348
|
end
|
@@ -346,12 +350,12 @@ HERE
|
|
346
350
|
@target_bitrate = nil
|
347
351
|
else
|
348
352
|
unless arg =~ /^[1-9][0-9]*$/
|
349
|
-
fail UsageError, "invalid
|
353
|
+
fail UsageError, "invalid bitrate argument: #{arg}"
|
350
354
|
end
|
355
|
+
|
351
356
|
@target_bitrate = arg.to_i
|
352
357
|
end
|
353
358
|
|
354
|
-
@abr_bitrate = nil
|
355
359
|
@vbr_quality = nil
|
356
360
|
end
|
357
361
|
|
@@ -399,11 +403,6 @@ HERE
|
|
399
403
|
@constrain_crop = true
|
400
404
|
end
|
401
405
|
|
402
|
-
opts.on '--no-constrain-crop' do
|
403
|
-
Console.warn 'Using deprecated option: --no-constrain-crop'
|
404
|
-
@constrain_crop = false
|
405
|
-
end
|
406
|
-
|
407
406
|
opts.on '--fallback-crop ARG' do |arg|
|
408
407
|
@fallback_crop = case arg
|
409
408
|
when 'handbrake', 'mplayer', 'none'
|
@@ -702,14 +701,22 @@ HERE
|
|
702
701
|
@srt_offset[@srt_file.size - 1] = arg
|
703
702
|
end
|
704
703
|
|
705
|
-
opts.on '--
|
706
|
-
@
|
704
|
+
opts.on '--cvbr' do
|
705
|
+
@use_cvbr = true
|
706
|
+
@use_abr = false
|
707
|
+
@vbr_quality = nil
|
708
|
+
end
|
709
|
+
|
710
|
+
opts.on '--abr' do
|
711
|
+
@use_abr = true
|
712
|
+
@use_cvbr = false
|
707
713
|
@vbr_quality = nil
|
708
714
|
end
|
709
715
|
|
710
716
|
opts.on '--vbr ARG', Float do |arg|
|
711
717
|
@vbr_quality = arg
|
712
|
-
@
|
718
|
+
@use_cvbr = false
|
719
|
+
@use_abr = false
|
713
720
|
end
|
714
721
|
|
715
722
|
opts.on '-E', '--encoder-option ARG' do |arg|
|
@@ -910,16 +917,16 @@ HERE
|
|
910
917
|
|
911
918
|
if width > 1920 or height > 1080
|
912
919
|
encoder_level = '5.1'
|
913
|
-
|
920
|
+
max_bitrate = @max_bitrate_2160p
|
914
921
|
elsif width > 1280 or height > 720
|
915
922
|
encoder_level = '4.0'
|
916
|
-
|
923
|
+
max_bitrate = @max_bitrate_1080p
|
917
924
|
elsif width * height > 720 * 576
|
918
925
|
encoder_level = '3.1'
|
919
|
-
|
926
|
+
max_bitrate = @max_bitrate_720p
|
920
927
|
else
|
921
928
|
encoder_level = '3.0'
|
922
|
-
|
929
|
+
max_bitrate = @max_bitrate_480p
|
923
930
|
end
|
924
931
|
|
925
932
|
case encoder
|
@@ -930,38 +937,37 @@ HERE
|
|
930
937
|
handbrake_options['encoder-profile'] = 'main'
|
931
938
|
end
|
932
939
|
|
933
|
-
if @
|
934
|
-
handbrake_options['quality'] = '1'
|
935
|
-
|
940
|
+
if @vbr_quality.nil?
|
936
941
|
if @target_bitrate.nil?
|
937
942
|
unless media.info[:directory]
|
938
943
|
bitrate = ((((media.info[:size] * 8) / media.info[:duration]) / 1000) / 1000) * 1000
|
939
944
|
|
940
|
-
if bitrate <
|
941
|
-
min_bitrate =
|
945
|
+
if bitrate < max_bitrate
|
946
|
+
min_bitrate = max_bitrate / 2
|
942
947
|
|
943
948
|
if bitrate < min_bitrate
|
944
|
-
|
949
|
+
max_bitrate = min_bitrate
|
945
950
|
else
|
946
|
-
|
951
|
+
max_bitrate = bitrate
|
947
952
|
end
|
948
953
|
end
|
949
954
|
end
|
950
955
|
else
|
951
|
-
|
956
|
+
max_bitrate = @target_bitrate
|
952
957
|
end
|
953
958
|
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
encoder_options['qpmax'] = '34'
|
959
|
+
if @use_abr
|
960
|
+
handbrake_options['vb'] = max_bitrate.to_s
|
961
|
+
else
|
962
|
+
handbrake_options['quality'] = '1'
|
963
|
+
encoder_options['vbv-maxrate'] = max_bitrate.to_s
|
964
|
+
encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', max_bitrate).to_i * 2).to_s
|
965
|
+
encoder_options['crf-max'] = @use_cvbr ? '30' : '25'
|
962
966
|
end
|
963
967
|
|
964
|
-
|
968
|
+
encoder_options['qpmax'] = '34' unless @use_cvbr
|
969
|
+
else
|
970
|
+
handbrake_options['quality'] = @vbr_quality.to_s.gsub(/\.0+$/, '')
|
965
971
|
end
|
966
972
|
|
967
973
|
if (@quick or @veryquick) and
|
@@ -131,6 +131,7 @@ module VideoTranscoding
|
|
131
131
|
end
|
132
132
|
|
133
133
|
@info[:h264] = false
|
134
|
+
@info[:hevc] = false
|
134
135
|
@info[:mpeg2] = false
|
135
136
|
audio_track = 0
|
136
137
|
subtitle_track = 0
|
@@ -148,6 +149,8 @@ module VideoTranscoding
|
|
148
149
|
|
149
150
|
if attributes =~ /^h264/
|
150
151
|
@info[:h264] = true
|
152
|
+
elsif attributes =~ /^hevc/
|
153
|
+
@info[:hevc] = true
|
151
154
|
elsif attributes =~ /^mpeg2video/
|
152
155
|
@info[:mpeg2] = true
|
153
156
|
end
|
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.16.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: 2017-01-
|
11
|
+
date: 2017-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Video Transcoding is a package of tools to transcode, inspect
|