other_video_transcoding 0.10.0 → 0.11.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: 2a38e8e2bf7937b708b2b024767f266beee682bc92f7377f4e8062dee7babd09
4
+ data.tar.gz: e3fd2a8a57f2fad558b9a30fcb2fae633b8b7120d9e802f3d08a65de1053b1ab
5
5
  SHA512:
6
- metadata.gz: dafd0f33a13e2b0f90db7e8ab8d0d7db19577177128dd133538593f762daddbf06c1ebf2735f05828b96255fc7970ce091434b78d9d80780598e9f18555ec5b1
7
- data.tar.gz: 8d294809aceafa52a1b73007593d9e36ca966e4aa15a43b4a4ca99c74f9df23bfb8c0c892b9ddba6d3fe009798f8de35480c942cbb26db2b3fd7c8b913022e6a
6
+ metadata.gz: d8dd9d8cb3788ec1d17379d167e75dbe506dca39b64a7e18f162021387d9329e0bb874b6a9bf298d866d27e5a47e151e43881708c3efc22730ee0fbc5004addc
7
+ data.tar.gz: db27d572846d979263b8c5b7286f011849b7b8c6669e18a740bed29db3b1fbf5c0d924a420e2f531f26f4ae97d85f484161adc5a5b006f5b4914415d31cc512c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
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.11.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.11.0)
6
+
7
+ Saturday, July 16, 2022
8
+
9
+ * 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.
10
+ * 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.
11
+ * 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).
12
+
5
13
  ## [0.10.0](https://github.com/donmelton/other_video_transcoding/releases/tag/0.10.0)
6
14
 
7
15
  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.11.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.11.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
@@ -2128,8 +2158,17 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2128
2158
  next if configurations[input_index] == configuration
2129
2159
 
2130
2160
  configurations[input_index] = configuration
2161
+
2162
+ if encoder == 'libfdk_aac' and not @fdk_vbr_mode.nil?
2163
+ bitrate = nil
2164
+ fdk_vbr_mode = @fdk_vbr_mode
2165
+ else
2166
+ fdk_vbr_mode = nil
2167
+ end
2168
+
2131
2169
  text = "#{sprintf("%2d", input_index)} = #{encoder}"
2132
2170
  text += " / #{bitrate} Kbps" unless bitrate.nil?
2171
+ text += " / VBR mode #{fdk_vbr_mode}" unless fdk_vbr_mode.nil?
2133
2172
  text += ' / stereo' unless channels.nil? or channels > 2
2134
2173
  text += " / #{titles[input_index]}" if titles.has_key?(input_index)
2135
2174
  Kernel.warn text
@@ -2140,6 +2179,7 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2140
2179
  "-c:a:#{index}", encoder,
2141
2180
  *(encoder == 'aac_at' ? ["-aac_at_mode:a:#{index}", 'cvbr'] : []),
2142
2181
  *(bitrate.nil? ? [] : ["-b:a:#{index}", "#{bitrate}k"]),
2182
+ *(fdk_vbr_mode.nil? ? [] : ["-vbr:a:#{index}", fdk_vbr_mode]),
2143
2183
  *(channels.nil? ? [] : ["-ac:a:#{index}", "#{channels}"]),
2144
2184
  *((encoder != 'copy' and track[:stream]['sample_rate'] != '48000') ? ["-ar:a:#{index}", '48000'] : []),
2145
2185
  *(copy_track_name ? [] : ["-metadata:s:a:#{index}", 'title=']),
@@ -2284,6 +2324,80 @@ Requires `ffprobe`, `ffmpeg` and `mkvpropedit`.
2284
2324
 
2285
2325
  fail "adding track statistics tags failed: #{output_path}" unless $CHILD_STATUS.exitstatus == 0
2286
2326
  end
2327
+
2328
+ def add_hdr_info(path, output_path)
2329
+ hdr_info = ''
2330
+
2331
+ IO.popen([
2332
+ 'ffprobe',
2333
+ '-loglevel', 'quiet',
2334
+ '-select_streams', 'v:0',
2335
+ '-show_frames',
2336
+ '-read_intervals', '%+#1',
2337
+ '-show_entries', 'frame=side_data_list',
2338
+ '-print_format', 'json',
2339
+ path
2340
+ ]) do |io|
2341
+ hdr_info = io.read
2342
+ end
2343
+
2344
+ fail "scanning media failed: #{path}" unless $CHILD_STATUS.exitstatus == 0
2345
+
2346
+ begin
2347
+ hdr_info = JSON.parse(hdr_info)
2348
+ rescue JSON::JSONError
2349
+ fail "media information not found: #{path}"
2350
+ end
2351
+
2352
+ md = nil
2353
+ cll = nil
2354
+
2355
+ hdr_info['frames'].each do |frame|
2356
+ frame.fetch('side_data_list', []).each do |side_data|
2357
+ if side_data['side_data_type'] == 'Mastering display metadata'
2358
+ md = side_data if md.nil?
2359
+ elsif side_data['side_data_type'] == 'Content light level metadata'
2360
+ cll = side_data if cll.nil?
2361
+ end
2362
+ end
2363
+ end
2364
+
2365
+ return if md.nil? or cll.nil?
2366
+
2367
+ Kernel.warn 'Adding HDR information...'
2368
+
2369
+ begin
2370
+ IO.popen([
2371
+ 'mkvpropedit',
2372
+ output_path,
2373
+ '--edit', 'track:v1',
2374
+ '--set', "max-content-light=#{cll['max_content']}",
2375
+ '--set', "max-frame-light=#{cll['max_average']}",
2376
+ '--set', "chromaticity-coordinates-red-x=#{eval md['red_x'] + '.0'}",
2377
+ '--set', "chromaticity-coordinates-red-y=#{eval md['red_y'] + '.0'}",
2378
+ '--set', "chromaticity-coordinates-green-x=#{eval md['green_x'] + '.0'}",
2379
+ '--set', "chromaticity-coordinates-green-y=#{eval md['green_y'] + '.0'}",
2380
+ '--set', "chromaticity-coordinates-blue-x=#{eval md['blue_x'] + '.0'}",
2381
+ '--set', "chromaticity-coordinates-blue-y=#{eval md['blue_y'] + '.0'}",
2382
+ '--set', "white-coordinates-x=#{eval md['white_point_x'] + '.0'}",
2383
+ '--set', "white-coordinates-y=#{eval md['white_point_y'] + '.0'}",
2384
+ '--set', "max-luminance=#{eval md['max_luminance'] + '.0'}",
2385
+ '--set', "min-luminance=#{eval md['min_luminance'] + '.0'}"
2386
+ ], 'rb') do |io|
2387
+ Signal.trap 'INT' do
2388
+ Process.kill 'INT', io.pid
2389
+ end
2390
+
2391
+ io.each_char do |char|
2392
+ STDERR.print char
2393
+ end
2394
+ end
2395
+ rescue SystemCallError => e
2396
+ raise "adding HDR information failed: #{e}"
2397
+ end
2398
+
2399
+ fail "adding HDR information failed: #{output_path}" unless $CHILD_STATUS.exitstatus == 0
2400
+ end
2287
2401
  end
2288
2402
  end
2289
2403
 
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.11.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.11.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-07-16 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,7 @@ 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
30
31
  - other_video_transcoding-0.2.0.gem
31
32
  - other_video_transcoding-0.3.0.gem
32
33
  - other_video_transcoding-0.3.1.gem
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  - !ruby/object:Gem::Version
58
59
  version: '0'
59
60
  requirements: []
60
- rubygems_version: 3.1.6
61
+ rubygems_version: 3.3.7
61
62
  signing_key:
62
63
  specification_version: 4
63
64
  summary: Other tools to transcode videos.