video_transcoding 0.4.0 → 0.5.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 +29 -31
- data/bin/transcode-video +35 -19
- 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: 904cedcc3f672a942705af405ab944ed1fd8a69e
|
4
|
+
data.tar.gz: 682950abf5c67fa62680dacde2a065d1bd88d0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b4f1c5c66d22a5af7b34977c9bacb390613ce50367bd851b7747410b9a7bd1141c6609fee6cf5ebcbdb20ca1b74a275f7d36bf43b3038f0b7118d6cd17c9540
|
7
|
+
data.tar.gz: 38668e7971abb556ef149a7838ed93620ff2f1460dd1341a2550bc7e39014d2fbd5fe2c325e661b716b9385b0206a876fb979dc76743a58d481a7793d6fa75dd
|
data/README.md
CHANGED
@@ -84,31 +84,31 @@ When installing `HandBrakeCLI` or other downloaded programs, make sure the execu
|
|
84
84
|
|
85
85
|
### Why `transcode-video`?
|
86
86
|
|
87
|
-
Videos from the [iTunes Store](https://en.wikipedia.org/wiki/ITunes_Store) are my template for a portable format while remaining high enough quality to be mistaken for the originals. Their files are very good quality,
|
87
|
+
Videos from the [iTunes Store](https://en.wikipedia.org/wiki/ITunes_Store) are my template for a portable format while remaining high enough quality to be mistaken for the originals. Their files are very good quality, much smaller than the same video on a Blu-ray Disc, and play on a wide variety of devices.
|
88
88
|
|
89
89
|
HandBrake is a powerful video transcoding tool but it's complicated to configure. It has several presets but they aren't smart enough to automatically change bitrate targets and other encoding options based on different inputs. More importantly, HandBrake's default presets don't produce a predictable output size with sufficient quality.
|
90
90
|
|
91
91
|
HandBrake's "AppleTV 3" preset is closest to what I want but transcoding "[Planet Terror (2007)](http://www.blu-ray.com/movies/Planet-Terror-Blu-ray/1248/)" with it results in a huge video bitrate of 19.9 Mbps, very near the original of 22.9 Mbps. And transcoding "[The Girl with the Dragon Tattoo (2011)](http://www.blu-ray.com/movies/The-Girl-with-the-Dragon-Tattoo-Blu-ray/35744/)," while much smaller in output size, lacks detail compared to the original.
|
92
92
|
|
93
|
-
So,
|
93
|
+
So, the `transcode-video` tool configures the [x264 video encoder](http://www.videolan.org/developers/x264.html) within HandBrake to use a [constrained variable bitrate (CVBR)](https://en.wikipedia.org/wiki/Variable_bitrate) mode, and to automatically target bitrates appropriate for different input resolutions.
|
94
94
|
|
95
95
|
Input resolution | Target video bitrate
|
96
96
|
--- | ---
|
97
|
-
1080p or Blu-ray video |
|
98
|
-
720p |
|
99
|
-
480i, 576p or DVD video |
|
97
|
+
1080p or Blu-ray video | 8 Mbps
|
98
|
+
720p | 6 Mbps
|
99
|
+
480i, 576p or DVD video | 3 Mbps
|
100
100
|
|
101
|
-
|
101
|
+
Actual output video bitrates are usually lower than these targets, especially for DVD video.
|
102
102
|
|
103
|
-
|
104
|
-
--- | --- | --- | ---
|
105
|
-
Mono | AAC only | 80 Kbps | none
|
106
|
-
Stereo | AAC only | 160 Kbps | none
|
107
|
-
Surround | AC-3 only, up to 448 Kbps | 160 Kbps | 384 Kbps with 5.1 channels
|
103
|
+
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.
|
108
104
|
|
109
|
-
|
105
|
+
Input channels | AAC track | AC-3 track
|
106
|
+
--- | --- | ---
|
107
|
+
Mono | 80 Kbps | none
|
108
|
+
Stereo | 160 Kbps | none
|
109
|
+
Surround | 160 Kbps | 640 Kbps with 5.1 channels
|
110
110
|
|
111
|
-
But
|
111
|
+
But most of these default settings and automatic behaviors can be easily overridden or augmented with additional command line options.
|
112
112
|
|
113
113
|
### Why `detect-crop`?
|
114
114
|
|
@@ -194,31 +194,31 @@ To create MP4 output with the `.m4v` file extension instead of `.mp4`, use the `
|
|
194
194
|
|
195
195
|
The `.m4v` file extension is more "iTunes-friendly," but the file content itself is exactly the same as a file with the `.mp4` extension.
|
196
196
|
|
197
|
-
####
|
197
|
+
#### Reducing output size
|
198
198
|
|
199
|
-
If
|
199
|
+
If reducing output size is more important to you than quality, use the `--small` option:
|
200
200
|
|
201
|
-
transcode-video --
|
201
|
+
transcode-video --small "/path/to/Movie.mkv"
|
202
202
|
|
203
|
-
Video bitrate targets are
|
203
|
+
Video bitrate targets are lowered 33-37% depending upon the video resolution of your input.
|
204
204
|
|
205
|
-
Input resolution | Target video bitrate with `--
|
205
|
+
Input resolution | Target video bitrate with `--small`
|
206
206
|
--- | ---
|
207
|
-
1080p or Blu-ray video |
|
208
|
-
720p |
|
209
|
-
480i, 576p or DVD video |
|
207
|
+
1080p or Blu-ray video | 5 Mbps
|
208
|
+
720p | 4 Mbps
|
209
|
+
480i, 576p or DVD video | 2 Mbps
|
210
210
|
|
211
|
-
Dolby Digital AC-3 audio bitrate limits are
|
211
|
+
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.
|
212
212
|
|
213
|
-
Input channels | Pass through<br />with `--
|
213
|
+
Input channels | Pass through<br />with `--small` | AAC track<br />with `--small` | AC-3 track<br />with `--small`
|
214
214
|
--- | --- | --- | ---
|
215
215
|
Mono | AAC only | 80 Kbps | none
|
216
216
|
Stereo | AAC only | 160 Kbps | none
|
217
|
-
Surround | AC-3 only, up to
|
217
|
+
Surround | AC-3 only, up to 448 Kbps | 160 Kbps | 384 Kbps with 5.1 channels
|
218
218
|
|
219
|
-
|
219
|
+
This makes the output of `transcode-video` very near the same size as videos from the iTunes Store, including their audio tracks.
|
220
220
|
|
221
|
-
|
221
|
+
With `--small`, noisy video and complex surround audio have the most potential for perceptible quality loss.
|
222
222
|
|
223
223
|
#### Improving performance
|
224
224
|
|
@@ -226,14 +226,12 @@ If you're willing to trade some precision for a 45-50% increase in video encodin
|
|
226
226
|
|
227
227
|
transcode-video --quick "/path/to/Movie.mkv"
|
228
228
|
|
229
|
-
The precision loss is minor and, when combined with the `--big` option, may not even be perceptible:
|
230
|
-
|
231
|
-
transcode-video --big --quick "/path/to/Movie.mkv"
|
232
|
-
|
233
229
|
The `--quick` option is also more than 15% speedier than the x264 video encoder's "fast" preset and it avoids the occasional quality loss problems of the "faster" and "veryfast" presets.
|
234
230
|
|
235
231
|
Be aware that output files are slightly larger when using the `--quick` option since the loss of precision is also a loss of efficiency.
|
236
232
|
|
233
|
+
Performance also improves slightly using the `--small` option due to fewer calculations being made and fewer bits being written to disk.
|
234
|
+
|
237
235
|
#### Cropping
|
238
236
|
|
239
237
|
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.
|
@@ -479,7 +477,7 @@ Use the default settings whenever possible.
|
|
479
477
|
|
480
478
|
Use the `--mp4` or `--m4v` options if your target player can't handle Matroska format.
|
481
479
|
|
482
|
-
Use the `--
|
480
|
+
Use the `--small` option if you're short on storage space or you want your files near the same size as those from the iTunes Store.
|
483
481
|
|
484
482
|
Use the `--quick` option if you're in a hurry or you have a huge number of files to transcode.
|
485
483
|
|
data/bin/transcode-video
CHANGED
@@ -56,8 +56,9 @@ Output options:
|
|
56
56
|
--dry-run don't transcode, just show `HandBrakeCLI` command and exit
|
57
57
|
|
58
58
|
Quality options:
|
59
|
-
--
|
60
|
-
|
59
|
+
--small, --small-video
|
60
|
+
lower default limits for both video and AC-3 audio bitrates
|
61
|
+
or for video only, trading some quality for reduced size
|
61
62
|
--quick trade some precision for 45-50% increase in encoding speed
|
62
63
|
(more than 15% speedier than x264 encoder "fast" preset)
|
63
64
|
(avoids quality loss of "faster" and "veryfast" presets)
|
@@ -163,12 +164,9 @@ External subtitle options:
|
|
163
164
|
to previously burned, forced or added subtitle
|
164
165
|
(can be used multiple times)
|
165
166
|
|
166
|
-
|
167
|
-
--cvbr BITRATE use Constrained VBR ratecontrol at target video bitrate
|
167
|
+
Advanced options:
|
168
168
|
--abr BITRATE use modified ABR ratecontrol at average video bitrate
|
169
169
|
--vbr QUALITY use true VBR ratecontrol at constant video quality (0-51)
|
170
|
-
|
171
|
-
Advanced options:
|
172
170
|
-E, --encoder-option NAME=VALUE|_NAME
|
173
171
|
pass x264 video encoder option by name with value
|
174
172
|
or disable use of option by prefixing name with "_"
|
@@ -205,10 +203,10 @@ HERE
|
|
205
203
|
@format = :mkv
|
206
204
|
@log = true
|
207
205
|
@dry_run = false
|
208
|
-
@vbv_maxrate_2160p =
|
209
|
-
@vbv_maxrate_1080p =
|
210
|
-
@vbv_maxrate_720p =
|
211
|
-
@vbv_maxrate_480p =
|
206
|
+
@vbv_maxrate_2160p = 16000
|
207
|
+
@vbv_maxrate_1080p = 8000
|
208
|
+
@vbv_maxrate_720p = 6000
|
209
|
+
@vbv_maxrate_480p = 3000
|
212
210
|
@quick = false
|
213
211
|
@crop = {:top => 0, :bottom => 0, :left => 0, :right => 0}
|
214
212
|
@main_audio = nil
|
@@ -216,8 +214,8 @@ HERE
|
|
216
214
|
@audio_name = {}
|
217
215
|
@audio_language = []
|
218
216
|
@audio_width = {:main => :double, :other => :stereo}
|
219
|
-
@ac3_bitrate =
|
220
|
-
@pass_ac3_bitrate =
|
217
|
+
@ac3_bitrate = 640
|
218
|
+
@pass_ac3_bitrate = 640
|
221
219
|
@copy_audio = []
|
222
220
|
@copy_audio_name = []
|
223
221
|
@burn_subtitle = nil
|
@@ -231,9 +229,9 @@ HERE
|
|
231
229
|
@srt_language = {}
|
232
230
|
@srt_encoding = {}
|
233
231
|
@srt_offset = {}
|
234
|
-
@cvbr_bitrate = nil
|
235
232
|
@abr_bitrate = nil
|
236
233
|
@vbr_quality = nil
|
234
|
+
@cvbr_bitrate = nil
|
237
235
|
@encoder_options = {}
|
238
236
|
@disable_encoder_options = []
|
239
237
|
@handbrake_options = {'encoder-preset' => 'medium', 'encoder-profile' => 'high'}
|
@@ -288,7 +286,24 @@ HERE
|
|
288
286
|
opts.on('--no-log') { @log = false }
|
289
287
|
opts.on('--dry-run') { @dry_run = true }
|
290
288
|
|
289
|
+
opts.on '--small' do
|
290
|
+
@vbv_maxrate_2160p = 10000
|
291
|
+
@vbv_maxrate_1080p = 5000
|
292
|
+
@vbv_maxrate_720p = 4000
|
293
|
+
@vbv_maxrate_480p = 2000
|
294
|
+
@ac3_bitrate = 384
|
295
|
+
@pass_ac3_bitrate = 448
|
296
|
+
end
|
297
|
+
|
298
|
+
opts.on '--small-video' do
|
299
|
+
@vbv_maxrate_2160p = 10000
|
300
|
+
@vbv_maxrate_1080p = 5000
|
301
|
+
@vbv_maxrate_720p = 4000
|
302
|
+
@vbv_maxrate_480p = 2000
|
303
|
+
end
|
304
|
+
|
291
305
|
opts.on '--big' do
|
306
|
+
Console.warn 'Using deprecated option: --big'
|
292
307
|
@vbv_maxrate_2160p = 16000
|
293
308
|
@vbv_maxrate_1080p = 8000
|
294
309
|
@vbv_maxrate_720p = 6000
|
@@ -593,12 +608,6 @@ HERE
|
|
593
608
|
@srt_offset[@srt_file.size - 1] = arg
|
594
609
|
end
|
595
610
|
|
596
|
-
opts.on '--cvbr ARG', Integer do |arg|
|
597
|
-
@cvbr_bitrate = arg
|
598
|
-
@abr_bitrate = nil
|
599
|
-
@vbr_quality = nil
|
600
|
-
end
|
601
|
-
|
602
611
|
opts.on '--abr ARG', Integer do |arg|
|
603
612
|
@abr_bitrate = arg
|
604
613
|
@cvbr_bitrate = nil
|
@@ -611,6 +620,13 @@ HERE
|
|
611
620
|
@abr_bitrate = nil
|
612
621
|
end
|
613
622
|
|
623
|
+
opts.on '--cvbr ARG', Integer do |arg|
|
624
|
+
Console.warn 'Using experimental option: --cvbr'
|
625
|
+
@cvbr_bitrate = arg
|
626
|
+
@abr_bitrate = nil
|
627
|
+
@vbr_quality = nil
|
628
|
+
end
|
629
|
+
|
614
630
|
opts.on '-E', '--encoder-option ARG' do |arg|
|
615
631
|
if arg =~ /^([a-z0-9][a-z0-9_-]+)=([^ :]+)$/
|
616
632
|
@encoder_options[$1] = $2
|
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.5.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-01-
|
11
|
+
date: 2016-01-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
|