other_video_transcoding 0.10.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 325b662c56c03a0cac33994a3ab165381fe801615072c87188de4b8f6bd954f7
4
- data.tar.gz: c26a3551deed5d3966168b881da8730672024b8363fc1e0e8611a27ca5ec9426
3
+ metadata.gz: 34125313312fdd2df4d4ee02edb1bf215d30f84aec152beed03e4a5652ed9168
4
+ data.tar.gz: b2d1e94d78b4a4ad4957586f432eb011f7a20b77f07669ec997b1e7bf1ea5eb6
5
5
  SHA512:
6
- metadata.gz: dafd0f33a13e2b0f90db7e8ab8d0d7db19577177128dd133538593f762daddbf06c1ebf2735f05828b96255fc7970ce091434b78d9d80780598e9f18555ec5b1
7
- data.tar.gz: 8d294809aceafa52a1b73007593d9e36ca966e4aa15a43b4a4ca99c74f9df23bfb8c0c892b9ddba6d3fe009798f8de35480c942cbb26db2b3fd7c8b913022e6a
6
+ metadata.gz: a8211a1898a41add509c7be63dcef1a639f597f0a21ff1b97164a3a71c14a939480a657fb6412cbe5caf99ba4b5e213fdd04d2a3432b316e768920c3882b1105
7
+ data.tar.gz: b933a52ab07ff31ba495f94a02c18f1d3a985685c0ea69ab7a7b9b6fa040897068ef0642c0ab15b09c7a618ac9846a73f8b3f5ce728b19023d59bb40cc3c5a51
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This single document contains all of the notes created for each [release](https://github.com/donmelton/other_video_transcoding/releases).
4
4
 
5
+ ## [0.12.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.12.0)
6
+
7
+ Wednesday, October 12, 2022
8
+
9
+ * Modify `other-transcode` to explicitly set the output layout for AC-3 and Dolby Digital Plus (Enhanced AC-3) surround audio formats to six channels when the input has more than six channels, typically with 7.1 surround audio. Otherwise new versions of `ffmpeg` will only create five channels and drop the LFE channel. Via [ #167](https://github.com/donmelton/other_video_transcoding/issues/167).
10
+
11
+ ## [0.11.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.11.0)
12
+
13
+ Saturday, July 16, 2022
14
+
15
+ * Modify `other-transcode` to copy 10-bit high-dynamic-range (HDR10) metadata, extracting content light level and mastering display metadata from a HDR10 video frame input and tagging a 10-bit video stream output in Matroska (MKV) format with that information. This will also copy static HDR10 metadata from Dolby Vision and HDR10+ video streams but it will _not_ copy additional dynamic metadata from those formats.
16
+ * Add a `--overlay-params` option to `other-transcode` to override the `overlay` filter configuration applied when burning subtitles. This is useful when cropping to move a subtitle within the output boundary.
17
+ * Add a `--fdk-vbr` option to `other-transcode` to set the numeric variable bitrate (VBR) mode for the Fraunhofer `libfdk_aac` audio encoder, disabling constant bitrate (CBR) ratecontrol. VBR mode `1` selects the lowest quality and `5` the highest. Please note that the `libfdk_aac` encoder is not normally included with `ffmpeg` due to licensing restrictions and the `--fdk-vbr` option has no effect if that encoder is not available. Via [ #127](https://github.com/donmelton/other_video_transcoding/issues/127).
18
+
5
19
  ## [0.10.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.10.0)
6
20
 
7
21
  Thursday, January 27, 2022
data/bin/ask-ffmpeg-log CHANGED
@@ -16,7 +16,7 @@ module Transcoding
16
16
  class Command
17
17
  def about
18
18
  <<-HERE
19
- ask-ffmpeg-log 0.10.0
19
+ ask-ffmpeg-log 0.12.0
20
20
  Copyright (c) 2019-2022 Don Melton
21
21
  HERE
22
22
  end
data/bin/other-transcode CHANGED
@@ -18,7 +18,7 @@ module Transcoding
18
18
  class Command
19
19
  def about
20
20
  <<-HERE
21
- other-transcode 0.10.0
21
+ other-transcode 0.12.0
22
22
  Copyright (c) 2019-2022 Don Melton
23
23
  HERE
24
24
  end
@@ -137,6 +137,8 @@ Video options:
137
137
 
138
138
  def usage10
139
139
  <<-HERE
140
+ --overlay-params KEY=VALUE[:KEY=VALUE]...
141
+ override subtitle overlay filter configuration
140
142
  --yadif-params KEY=VALUE[:KEY=VALUE]...
141
143
  override yadif deinterlace filter configuration
142
144
  --rc-maxrate FACTOR, --rc-bufsize FACTOR|BITRATE
@@ -294,6 +296,14 @@ Audio options:
294
296
  def usage19
295
297
  <<-HERE
296
298
 
299
+ Fraunhofer FDK AAC audio encoder options:
300
+ --fdk-vbr MODE set numeric variable bitrate (VBR) mode, from 1 to 5
301
+ HERE
302
+ end
303
+
304
+ def usage20
305
+ <<-HERE
306
+
297
307
  Subtitle options:
298
308
  --add-subtitle TRACK[=forced]|auto|all|LANGUAGE|STRING
299
309
  add single subtitle track by number
@@ -351,6 +361,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
351
361
  @rate = nil
352
362
  @detelecine = false
353
363
  @enable_filters = true
364
+ @overlay_params = nil
354
365
  @yadif_params = nil
355
366
  @maxrate = nil
356
367
  @bufsize = nil
@@ -392,6 +403,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
392
403
  @keep_ac3_surround = true
393
404
  @keep_ac3_stereo = false
394
405
  @pass_dts = false
406
+ @fdk_vbr_mode = nil
395
407
  @subtitle_selections = []
396
408
  @auto_add_subtitle = false
397
409
  @burn_subtitle_track = 0
@@ -408,14 +420,14 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
408
420
  puts usage1 + usage2 + usage3 + usage4 + usage5 + usage6 +
409
421
  usage7 + usage8 + usage9 + usage10 + usage11 + usage12 +
410
422
  usage13 + usage14 + usage15 + usage16 + usage17 +
411
- usage18 + usage19
423
+ usage18 + usage19 + usage20
412
424
  when 'more'
413
425
  puts usage1 + usage2 + usage3 + usage4 + usage6 + usage7 +
414
426
  usage8 + usage9 + usage11 + usage13 + usage15 + usage16 +
415
- usage17 + usage18 + usage19
427
+ usage17 + usage18 + usage20
416
428
  else
417
429
  puts usage1 + usage3 + usage6 + usage8 + usage11 + usage13 +
418
- usage15 + usage17 + usage19
430
+ usage15 + usage17 + usage20
419
431
  end
420
432
 
421
433
  exit
@@ -656,6 +668,14 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
656
668
  @enable_filters = false
657
669
  end
658
670
 
671
+ opts.on '--overlay-params ARG' do |arg|
672
+ arg.split ':' do |param|
673
+ fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,\(\)]+$/
674
+ end
675
+
676
+ @overlay_params = arg
677
+ end
678
+
659
679
  opts.on '--yadif-params ARG' do |arg|
660
680
  arg.split ':' do |param|
661
681
  fail UsageError, "invalid argument: #{arg}" unless param =~ /^[\w\-]+=[\w\-\.,\(\)]+$/
@@ -945,6 +965,10 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
945
965
  @surround_encoder ||= 'ac3'
946
966
  end
947
967
 
968
+ opts.on '--fdk-vbr ARG', Integer do |arg|
969
+ @fdk_vbr_mode = [[arg, 1].max, 5].min.to_s
970
+ end
971
+
948
972
  opts.on '--add-subtitle ARG' do |arg|
949
973
  if arg =~ /^([0-9]+)(?:=(forced))?$|^(auto)$|^([a-z]{3})$|^(.*)$/
950
974
  @subtitle_selections += [{
@@ -1258,6 +1282,11 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
1258
1282
  Kernel.warn 'Done.'
1259
1283
  else
1260
1284
  add_track_statistics_tags output_path
1285
+ ten_bit = (@ten_bit ? (@eight_bit_vc1 ? (video['codec_name'] != 'vc1') : true) : false)
1286
+
1287
+ if (video.fetch('pix_fmt', 'yuv420p') == 'yuv420p10le') and ten_bit
1288
+ add_hdr_info path, output_path
1289
+ end
1261
1290
  end
1262
1291
 
1263
1292
  Kernel.warn "\nElapsed time: #{seconds_to_time(Time.now.tv_sec - seconds)}\n\n"
@@ -1621,6 +1650,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
1621
1650
  overlay_filter = nil
1622
1651
  else
1623
1652
  overlay_filter = "[0:#{burn_subtitle['index']}]overlay"
1653
+ overlay_filter += "=#{@overlay_params}" unless @overlay_params.nil?
1624
1654
  end
1625
1655
 
1626
1656
  deinterlace = @deinterlace
@@ -2093,6 +2123,8 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2093
2123
  if encoder =~ /aac/
2094
2124
  encoder = @aac_fallback_encoder if encoder == 'aac_at'
2095
2125
  channels = 6
2126
+ elsif input_channels > 6
2127
+ channels = 6
2096
2128
  end
2097
2129
  end
2098
2130
  end
@@ -2128,8 +2160,17 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2128
2160
  next if configurations[input_index] == configuration
2129
2161
 
2130
2162
  configurations[input_index] = configuration
2163
+
2164
+ if encoder == 'libfdk_aac' and not @fdk_vbr_mode.nil?
2165
+ bitrate = nil
2166
+ fdk_vbr_mode = @fdk_vbr_mode
2167
+ else
2168
+ fdk_vbr_mode = nil
2169
+ end
2170
+
2131
2171
  text = "#{sprintf("%2d", input_index)} = #{encoder}"
2132
2172
  text += " / #{bitrate} Kbps" unless bitrate.nil?
2173
+ text += " / VBR mode #{fdk_vbr_mode}" unless fdk_vbr_mode.nil?
2133
2174
  text += ' / stereo' unless channels.nil? or channels > 2
2134
2175
  text += " / #{titles[input_index]}" if titles.has_key?(input_index)
2135
2176
  Kernel.warn text
@@ -2140,6 +2181,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2140
2181
  "-c:a:#{index}", encoder,
2141
2182
  *(encoder == 'aac_at' ? ["-aac_at_mode:a:#{index}", 'cvbr'] : []),
2142
2183
  *(bitrate.nil? ? [] : ["-b:a:#{index}", "#{bitrate}k"]),
2184
+ *(fdk_vbr_mode.nil? ? [] : ["-vbr:a:#{index}", fdk_vbr_mode]),
2143
2185
  *(channels.nil? ? [] : ["-ac:a:#{index}", "#{channels}"]),
2144
2186
  *((encoder != 'copy' and track[:stream]['sample_rate'] != '48000') ? ["-ar:a:#{index}", '48000'] : []),
2145
2187
  *(copy_track_name ? [] : ["-metadata:s:a:#{index}", 'title=']),
@@ -2284,6 +2326,80 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2284
2326
 
2285
2327
  fail "adding track statistics tags failed: #{output_path}" unless $CHILD_STATUS.exitstatus == 0
2286
2328
  end
2329
+
2330
+ def add_hdr_info(path, output_path)
2331
+ hdr_info = ''
2332
+
2333
+ IO.popen([
2334
+ 'ffprobe',
2335
+ '-loglevel', 'quiet',
2336
+ '-select_streams', 'v:0',
2337
+ '-show_frames',
2338
+ '-read_intervals', '%+#1',
2339
+ '-show_entries', 'frame=side_data_list',
2340
+ '-print_format', 'json',
2341
+ path
2342
+ ]) do |io|
2343
+ hdr_info = io.read
2344
+ end
2345
+
2346
+ fail "scanning media failed: #{path}" unless $CHILD_STATUS.exitstatus == 0
2347
+
2348
+ begin
2349
+ hdr_info = JSON.parse(hdr_info)
2350
+ rescue JSON::JSONError
2351
+ fail "media information not found: #{path}"
2352
+ end
2353
+
2354
+ md = nil
2355
+ cll = nil
2356
+
2357
+ hdr_info['frames'].each do |frame|
2358
+ frame.fetch('side_data_list', []).each do |side_data|
2359
+ if side_data['side_data_type'] == 'Mastering display metadata'
2360
+ md = side_data if md.nil?
2361
+ elsif side_data['side_data_type'] == 'Content light level metadata'
2362
+ cll = side_data if cll.nil?
2363
+ end
2364
+ end
2365
+ end
2366
+
2367
+ return if md.nil? or cll.nil?
2368
+
2369
+ Kernel.warn 'Adding HDR information...'
2370
+
2371
+ begin
2372
+ IO.popen([
2373
+ 'mkvpropedit',
2374
+ output_path,
2375
+ '--edit', 'track:v1',
2376
+ '--set', "max-content-light=#{cll['max_content']}",
2377
+ '--set', "max-frame-light=#{cll['max_average']}",
2378
+ '--set', "chromaticity-coordinates-red-x=#{eval md['red_x'] + '.0'}",
2379
+ '--set', "chromaticity-coordinates-red-y=#{eval md['red_y'] + '.0'}",
2380
+ '--set', "chromaticity-coordinates-green-x=#{eval md['green_x'] + '.0'}",
2381
+ '--set', "chromaticity-coordinates-green-y=#{eval md['green_y'] + '.0'}",
2382
+ '--set', "chromaticity-coordinates-blue-x=#{eval md['blue_x'] + '.0'}",
2383
+ '--set', "chromaticity-coordinates-blue-y=#{eval md['blue_y'] + '.0'}",
2384
+ '--set', "white-coordinates-x=#{eval md['white_point_x'] + '.0'}",
2385
+ '--set', "white-coordinates-y=#{eval md['white_point_y'] + '.0'}",
2386
+ '--set', "max-luminance=#{eval md['max_luminance'] + '.0'}",
2387
+ '--set', "min-luminance=#{eval md['min_luminance'] + '.0'}"
2388
+ ], 'rb') do |io|
2389
+ Signal.trap 'INT' do
2390
+ Process.kill 'INT', io.pid
2391
+ end
2392
+
2393
+ io.each_char do |char|
2394
+ STDERR.print char
2395
+ end
2396
+ end
2397
+ rescue SystemCallError => e
2398
+ raise "adding HDR information failed: #{e}"
2399
+ end
2400
+
2401
+ fail "adding HDR information failed: #{output_path}" unless $CHILD_STATUS.exitstatus == 0
2402
+ end
2287
2403
  end
2288
2404
  end
2289
2405
 
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'other_video_transcoding'
3
- s.version = '0.10.0'
3
+ s.version = '0.12.0'
4
4
  s.required_ruby_version = '>= 2.0'
5
5
  s.summary = 'Other tools to transcode videos.'
6
6
  s.description = <<-HERE
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: other_video_transcoding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
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: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " Other Video Transcoding is a package of tools to transcode videos.\n"
14
14
  email: don@blivet.com
@@ -27,6 +27,8 @@ files:
27
27
  - bin/other-transcode
28
28
  - other_video_transcoding-0.1.0.gem
29
29
  - other_video_transcoding-0.1.1.gem
30
+ - other_video_transcoding-0.10.0.gem
31
+ - other_video_transcoding-0.11.0.gem
30
32
  - other_video_transcoding-0.2.0.gem
31
33
  - other_video_transcoding-0.3.0.gem
32
34
  - other_video_transcoding-0.3.1.gem
@@ -57,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
59
61
  requirements: []
60
- rubygems_version: 3.1.6
62
+ rubygems_version: 3.3.7
61
63
  signing_key:
62
64
  specification_version: 4
63
65
  summary: Other tools to transcode videos.