video_transcoding 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1a2160cfa70551d7ab81f91c0e3cd683ac0b9bf
4
- data.tar.gz: b1a56c9b2e5a5b5e2dec110828f7014ace48f217
3
+ metadata.gz: 87623b30297fe1ddbce3986414be06e26c569b60
4
+ data.tar.gz: 5676f1d6d2167969670e434ee920135ec04646f5
5
5
  SHA512:
6
- metadata.gz: c7d9f359bacd4c0a44cebaf916da150921b26073f88d1dbe0a0b6b49c1a939c5e3d0fa5254f41e1a6596554ddab4ae9c35086b59d515f8ff9da91b32d1799f69
7
- data.tar.gz: 41beec3d9fe83947cf35bc51c17db29e05054b8f82c91604ba221dacd4e3bb8f47d26499e47ca5dc094d2c5481f6c7f544cfba24098e2d85ee989fe7fd0b1873
6
+ metadata.gz: 560af874e2847c118be25ec00fd9ee9197a3c41c09960c89ead29084ec62775fdb0ab93911a4a34be52af2e9ce86182077ef998667a2178d20755064b1db6e86
7
+ data.tar.gz: 6caf5107757863ac5da7d91a76119473394cbe81f8be1c8b5e4da06d9466c6fd8b41303522afe1652423656e7ad510a729cea0c2101b68cad045cb2c7a88acbb
data/README.md CHANGED
@@ -83,7 +83,9 @@ On OS X, the other dependencies can be easily installed via [Homebrew](http://br
83
83
 
84
84
  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.
85
85
 
86
- On Windows, it's best to search the Web for the appropriate binary or add-on package manager. The [VideoHelp](http://www.videohelp.com) and [Cygwin](https://cygwin.com/) sites are a good place to start.
86
+ On Windows, it's best to search the Web for the appropriate binary or add-on package manager. The [VideoHelp](http://www.videohelp.com) and [Cygwin](https://cygwin.com/) sites are a good place to start. Or you could try installing into the [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) as described here:
87
+
88
+ <https://gist.github.com/JMoVS/75f3c6b344648deef59bc761e5e5a0e6>
87
89
 
88
90
  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 OS X and Linux, that directory might be `/usr/local/bin`.
89
91
 
@@ -101,9 +103,9 @@ So, the `transcode-video` tool configures the [x264 video encoder](http://www.vi
101
103
 
102
104
  Input resolution | Target video bitrate
103
105
  --- | ---
104
- 1080p or Blu-ray video | 8000 Kbps
105
- 720p | 4000 Kbps
106
- 480i, 576p or DVD video | 2000 Kbps
106
+ 1080p or Blu-ray video | 6000 Kbps
107
+ 720p | 3000 Kbps
108
+ 480i, 576p or DVD video | 1500 Kbps
107
109
 
108
110
  When audio transcoding is required, it's done in [AAC format](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) and, if the original is [multi-channel surround sound](https://en.wikipedia.org/wiki/Surround_sound), in [Dolby Digital AC-3 format](https://en.wikipedia.org/wiki/Dolby_Digital). Meaning the output can contain two tracks from the same source in different formats. And mono, stereo and surround inputs are all handled differently.
109
111
 
@@ -193,30 +195,6 @@ To create MP4 output with the `.m4v` file extension instead of `.mp4`, use the `
193
195
 
194
196
  The `.m4v` file extension is more "iTunes-friendly," but the file content itself is exactly the same as a file with the `.mp4` extension.
195
197
 
196
- #### Reducing output size
197
-
198
- If reducing output size is more important to you than a possible loss in quality, use the `--small` option:
199
-
200
- transcode-video --small "/path/to/Movie.mkv"
201
-
202
- Video bitrate targets are lowered 33-37% depending upon the video resolution of your input.
203
-
204
- Input resolution | Target video bitrate with `--small`
205
- --- | ---
206
- 1080p or Blu-ray video | 5000 Kbps
207
- 720p | 3000 Kbps
208
- 480i, 576p or DVD video | 1600 Kbps
209
-
210
- Dolby Digital AC-3 audio bitrate limits are lowered 40%. However, there's no impact on the bitrate of mono and stereo AAC audio tracks.
211
-
212
- Input channels | Pass through<br />with `--small` | AAC track<br />with `--small` | AC-3 track<br />with `--small`
213
- --- | --- | --- | ---
214
- Mono | AAC only | 80 Kbps | none
215
- Stereo | AAC only | 160 Kbps | none
216
- Surround | AC-3 only, up to 448 Kbps | 160 Kbps | 384 Kbps with 5.1 channels
217
-
218
- With `--small`, noisy video and complex surround audio have the most potential for perceptible quality loss.
219
-
220
198
  #### Improving performance
221
199
 
222
200
  If you're willing to trade some precision for a 45-50% increase in video encoding speed, use the `--quick` option:
@@ -227,8 +205,6 @@ The `--quick` option is also more than 15% speedier than the x264 video encoder'
227
205
 
228
206
  Be aware that output files are slightly larger when using the `--quick` option since the loss of precision is also a loss of efficiency.
229
207
 
230
- Performance also improves using the `--small` option due to fewer calculations being made and fewer bits being written to disk.
231
-
232
208
  #### Cropping
233
209
 
234
210
  No cropping is applied by default. Use the `--crop TOP:BOTTOM:LEFT:RIGHT` option and arguments to indicate the amount of black, non-content border to remove from the edges of your video.
@@ -481,9 +457,9 @@ Preset name | Note
481
457
  `faster` | use with caution
482
458
  `fast` | good but you might want to use `--quick` instead
483
459
  `medium` | default
484
- `slow` | <!---->
485
- `slower` | <!---->
486
- `veryslow` | <!---->
460
+ `slow` | &#8203;
461
+ `slower` | &#8203;
462
+ `veryslow` | &#8203;
487
463
  `placebo` | not recommended
488
464
 
489
465
  Presets faster than `medium` trade precision and compression efficiency for more speed. That tradeoff is acceptable for the `fast` preset. But you may notice occasional quality loss problems when using the `faster` or `veryfast` presets.
@@ -496,8 +472,6 @@ Use the default settings whenever possible.
496
472
 
497
473
  Use the `--mp4` or `--m4v` options if your target player can't handle Matroska format.
498
474
 
499
- Use the `--small` option if you want more space savings.
500
-
501
475
  Use the `--quick` option if you're in a hurry.
502
476
 
503
477
  Use `detect-crop` before transcoding to manually review and apply the best crop values.
@@ -599,8 +573,6 @@ My ratecontrol system can't be applied with the current version of the x265 enco
599
573
 
600
574
  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.
601
575
 
602
- In the meantime, I recommend using the `--small` option to reduce output size. As a bonus, it's also faster.
603
-
604
576
  ### What about hardware-based video transcoding?
605
577
 
606
578
  Using hardware with [Intel Quick Sync Video](https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video) instead of software like x264 is certainly faster. HandBrake even supports that hardware on some platforms. However, my default ratecontrol system can't be applied to existing hardware encoders because they lack API to change the necessary settings.
@@ -627,18 +599,34 @@ What I don't use are [peak signal-to-noise ratios](https://en.wikipedia.org/wiki
627
599
 
628
600
  I use the default settings. That's why they're the defaults.
629
601
 
630
- But sometimes I use the `--small` option for more space savings.
631
-
632
602
  I never use the `--crop detect` function of `transcode-video` because I don't trust either `HandBrakeCLI` or `mplayer` 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.
633
603
 
634
604
  I let `transcode-video` automatically burn any forced subtitles into the output video track when the "forced" flag is enabled in the original.
635
605
 
636
606
  I never include separate subtitle tracks, but I do add audio commentary tracks.
637
607
 
638
- For a few problematic videos, I have to apply options like `--force-rate 23.976 --filter detelecine`. For others, options like `--encoder-option zones=...` to adjust bitrate distribution. But both of these cases are rare.
608
+ For a few problematic videos, I have to apply options like `--force-rate 23.976 --filter detelecine`. But that's rare.
639
609
 
640
610
  ## History
641
611
 
612
+ ### [0.12.0](https://github.com/donmelton/video_transcoding/releases/tag/0.12.0)
613
+
614
+ Friday, October 14, 2016
615
+
616
+ * Revise the ratecontrol system and default target video bitrates in `transcode-video` so that output is smaller and transcoding is faster. Via [ #90](https://github.com/donmelton/video_transcoding/issues/90).
617
+ * Increase the value of `vbv-bufsize` to be twice that of `vbv-maxrate`, the target. This is much more likely to produce an output video bitrate nearer to that target.
618
+ * Lower the targets to accomodate this new accuracy and avoid wasting bitrate and time on unneeded quality.
619
+ * Deprecate the `--small` and `--small-video` options in `transcode-video`.
620
+ * Add a variation of the `--target` option with `big` and `small` arguments to `transcode-video`. The `small` macro provides output similar to, but still smaller than, the old `--small-video` option. The `big` macro provides output even larger than the old ratecontrol system and targets.
621
+ * Remove unnecessary boundary checking of the target video bitrate in `transcode-video`.
622
+ * Modify `transcode-video` so adding `--handbrake-option encoder=x265` is all that is needed to enable _experimental_ HEVC transcoding. Use this _only_ with `HandBrakeCLI` nightly builds from September 29, 2016, or later.
623
+ * Update the "README" document to:
624
+ * Revise the default target video bitrates.
625
+ * Remove all references to the `--small` option since it's now deprecated.
626
+ * Add the Windows Subsystem for Linux as a possible installation platform. Via [ #89](https://github.com/donmelton/video_transcoding/pull/89) from [@JMoVS](https://github.com/JMoVS).
627
+ * Replace visible HTML comments with zero-width spaces.
628
+ * Tweak the description of how I use `transcode-video`. Yes, again.
629
+
642
630
  ### [0.11.1](https://github.com/donmelton/video_transcoding/releases/tag/0.11.1)
643
631
 
644
632
  Monday, September 26, 2016
data/bin/transcode-video CHANGED
@@ -56,9 +56,15 @@ Output options:
56
56
  --dry-run don't transcode, just show `HandBrakeCLI` command and exit
57
57
 
58
58
  Quality options:
59
- --small lower video bitrate target and AC-3 audio bitrate limits,
60
- trading some quality for reduced size
61
- --small-video lower video bitrate target only
59
+ --target big|small
60
+ apply video bitrate target macro for all input resolutions
61
+ (`big` trades some size for increased quality)
62
+ (`small` trades some quality for reduced size)
63
+ --target [2160p=|1080p=|720p=|480p=]BITRATE
64
+ set video bitrate target (default: based on input)
65
+ or target for specific input resolution
66
+ (can be exceeded to maintain video quality)
67
+ (can be used multiple times)
62
68
  --quick trade some precision for 45-50% increase in encoding speed
63
69
  (more than 15% speedier than x264 encoder "fast" preset)
64
70
  (avoids quality loss of "faster" and "veryfast" presets)
@@ -79,11 +85,6 @@ Video options:
79
85
  --pixel-aspect X:Y
80
86
  set pixel aspect ratio (default: 1:1)
81
87
  (e.g.: make X larger than Y to stretch horizontally)
82
- --target [1080p=|720p=|480p=]BITRATE
83
- set video bitrate target (default: based on input)
84
- or target for specific input resolution
85
- (can be exceeded to maintain video quality)
86
- (can be used multiple times)
87
88
  --force-rate FPS
88
89
  force constant video frame rate
89
90
  (`23.976` applied automatically for some inputs)
@@ -219,10 +220,10 @@ HERE
219
220
  @format = :mkv
220
221
  @log = true
221
222
  @dry_run = false
222
- @vbv_maxrate_2160p = 16000
223
- @vbv_maxrate_1080p = 8000
224
- @vbv_maxrate_720p = 4000
225
- @vbv_maxrate_480p = 2000
223
+ @vbv_maxrate_2160p = 12000
224
+ @vbv_maxrate_1080p = 6000
225
+ @vbv_maxrate_720p = 3000
226
+ @vbv_maxrate_480p = 1500
226
227
  @quick = false
227
228
  @crop = {:top => 0, :bottom => 0, :left => 0, :right => 0}
228
229
  @constrain_crop = false
@@ -254,7 +255,7 @@ HERE
254
255
  @vbr_quality = nil
255
256
  @encoder_options = {}
256
257
  @disable_encoder_options = []
257
- @handbrake_options = {'encoder-preset' => 'medium', 'encoder-profile' => 'high'}
258
+ @handbrake_options = {'encoder-preset' => 'medium'}
258
259
  @disable_handbrake_options = []
259
260
  @temporary = nil
260
261
  end
@@ -306,21 +307,63 @@ HERE
306
307
  opts.on('--no-log') { @log = false }
307
308
  opts.on('--dry-run') { @dry_run = true }
308
309
 
310
+ opts.on '--target ARG' do |arg|
311
+ case arg
312
+ when 'big'
313
+ @vbv_maxrate_2160p = 16000
314
+ @vbv_maxrate_1080p = 8000
315
+ @vbv_maxrate_720p = 4000
316
+ @vbv_maxrate_480p = 2000
317
+ when 'small'
318
+ @vbv_maxrate_2160p = 8000
319
+ @vbv_maxrate_1080p = 4000
320
+ @vbv_maxrate_720p = 2000
321
+ @vbv_maxrate_480p = 1000
322
+ when /^([0-9]+p)=([1-9][0-9]*)$/
323
+ bitrate = $2.to_i
324
+
325
+ case $1
326
+ when '2160p'
327
+ @vbv_maxrate_2160p = bitrate
328
+ when '1080p'
329
+ @vbv_maxrate_1080p = bitrate
330
+ when '720p'
331
+ @vbv_maxrate_720p = bitrate
332
+ when '480p'
333
+ @vbv_maxrate_480p = bitrate
334
+ else
335
+ fail UsageError, "invalid target video bitrate resolution: #{$1}"
336
+ end
337
+
338
+ @target_bitrate = nil
339
+ else
340
+ unless arg =~ /^[1-9][0-9]*$/
341
+ fail UsageError, "invalid rate argument: #{arg}"
342
+ end
343
+ @target_bitrate = arg.to_i
344
+ end
345
+
346
+ @abr_bitrate = nil
347
+ @vbr_quality = nil
348
+ end
349
+
309
350
  opts.on '--small' do
310
- @vbv_maxrate_2160p = 10000
311
- @vbv_maxrate_1080p = 5000
312
- @vbv_maxrate_720p = 3000
313
- @vbv_maxrate_480p = 1600
351
+ Console.warn 'Using deprecated option: --small'
352
+ @vbv_maxrate_2160p = 8000
353
+ @vbv_maxrate_1080p = 4000
354
+ @vbv_maxrate_720p = 2000
355
+ @vbv_maxrate_480p = 1000
314
356
  @ac3_bitrate = 384
315
357
  @pass_ac3_bitrate = 448
316
358
  @target_bitrate = nil
317
359
  end
318
360
 
319
361
  opts.on '--small-video' do
320
- @vbv_maxrate_2160p = 10000
321
- @vbv_maxrate_1080p = 5000
322
- @vbv_maxrate_720p = 3000
323
- @vbv_maxrate_480p = 1600
362
+ Console.warn 'Using deprecated option: --small-video'
363
+ @vbv_maxrate_2160p = 8000
364
+ @vbv_maxrate_1080p = 4000
365
+ @vbv_maxrate_720p = 2000
366
+ @vbv_maxrate_480p = 1000
324
367
  @target_bitrate = nil
325
368
  end
326
369
 
@@ -403,35 +446,6 @@ HERE
403
446
  end
404
447
  end
405
448
 
406
- opts.on '--target ARG' do |arg|
407
- if arg =~ /^([0-9]+p)=([1-9][0-9]*)$/
408
- bitrate = $2.to_i
409
-
410
- case $1
411
- when '2160p'
412
- @vbv_maxrate_2160p = bitrate
413
- when '1080p'
414
- @vbv_maxrate_1080p = bitrate
415
- when '720p'
416
- @vbv_maxrate_720p = bitrate
417
- when '480p'
418
- @vbv_maxrate_480p = bitrate
419
- else
420
- fail UsageError, "invalid target video bitrate resolution: #{$1}"
421
- end
422
-
423
- @target_bitrate = nil
424
- else
425
- unless arg =~ /^[1-9][0-9]*$/
426
- fail UsageError, "invalid rate argument: #{arg}"
427
- end
428
- @target_bitrate = arg.to_i
429
- end
430
-
431
- @abr_bitrate = nil
432
- @vbr_quality = nil
433
- end
434
-
435
449
  opts.on '--force-rate ARG' do |arg|
436
450
  unless arg =~ /^[1-9][0-9]*(?:\.[0-9]+)?$/
437
451
  fail UsageError, "invalid force rate argument: #{arg}"
@@ -860,19 +874,27 @@ HERE
860
874
  handbrake_options[anamorphic] = nil unless @handbrake_options.has_key? 'custom-anamorphic'
861
875
 
862
876
  if width > 1920 or height > 1080
863
- handbrake_options['encoder-level'] = '5.1'
877
+ encoder_level = '5.1'
864
878
  vbv_maxrate = @vbv_maxrate_2160p
865
879
  elsif width > 1280 or height > 720
866
- handbrake_options['encoder-level'] = '4.0'
880
+ encoder_level = '4.0'
867
881
  vbv_maxrate = @vbv_maxrate_1080p
868
882
  elsif width * height > 720 * 576
869
- handbrake_options['encoder-level'] = '3.1'
883
+ encoder_level = '3.1'
870
884
  vbv_maxrate = @vbv_maxrate_720p
871
885
  else
872
- handbrake_options['encoder-level'] = '3.0'
886
+ encoder_level = '3.0'
873
887
  vbv_maxrate = @vbv_maxrate_480p
874
888
  end
875
889
 
890
+ case @handbrake_options.fetch('encoder', 'x264')
891
+ when 'x264'
892
+ handbrake_options['encoder-profile'] = 'high'
893
+ handbrake_options['encoder-level'] = encoder_level
894
+ when 'x265'
895
+ handbrake_options['encoder-profile'] = 'main'
896
+ end
897
+
876
898
  if @abr_bitrate.nil? and @vbr_quality.nil?
877
899
  handbrake_options['quality'] = '1'
878
900
 
@@ -891,17 +913,11 @@ HERE
891
913
  end
892
914
  end
893
915
  else
894
- if @target_bitrate < 2
895
- vbv_maxrate = 2
896
- elsif @target_bitrate > 300000
897
- vbv_maxrate = 300000
898
- else
899
- vbv_maxrate = @target_bitrate
900
- end
916
+ vbv_maxrate = @target_bitrate
901
917
  end
902
918
 
903
919
  encoder_options['vbv-maxrate'] = vbv_maxrate.to_s
904
- encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', vbv_maxrate).to_i / 2).to_s
920
+ encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', vbv_maxrate).to_i * 2).to_s
905
921
  encoder_options['crf-max'] = '25'
906
922
  encoder_options['qpmax'] = '34'
907
923
  else
@@ -5,5 +5,5 @@
5
5
  #
6
6
 
7
7
  module VideoTranscoding
8
- VERSION = '0.11.1'
8
+ VERSION = '0.12.0'
9
9
  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.11.1
4
+ version: 0.12.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: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Video Transcoding is a package of tools to transcode, inspect