video_transcoding 0.20.1 → 0.21.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: 02c06ade0e781a2114c61c7023f8f1bd4b27ebf7183e4930ebb8b7d7b29f6b49
4
- data.tar.gz: f40706b9d74e78dc5b8c089723961f9af8d6bbb349e68d879c4ae0cbf8719fc7
3
+ metadata.gz: eee67d682d1fca2bcf4fc34cf8fe9e3c5d907af8a92bfb31f5d260378992f14c
4
+ data.tar.gz: a4dbf00b048a9e123d519dffe6b2ffdd99a7d44019ce39f4c95be83e5e5156e0
5
5
  SHA512:
6
- metadata.gz: 2710530ebbf264ed4fb257fd46ad04c1af06ee3aeab6ea3e6e65b00331f44403b6b15714c6afd6bd68fc00afd54a2aba43d87339c9ace176193a1f15738ca130
7
- data.tar.gz: 7091576337ca4291da6cdc52e4eaffabd540304c1949bae43548e901c5e55f9761c1223bce6dd9cd7487864066b583b338ed438e1c4b9b2b03b35c257823893d
6
+ metadata.gz: 91d460a5108997257acbbfab99d4249a492928d2b449314ad18f82159206332bc48283866c7e1f079ac766faf63ef4d00f3a5f6b87e8cb059c8a44f454896076
7
+ data.tar.gz: 1b23cf95baea10e7fa91f3fd88602de7864a2c33716a180cc9fa04e32cc4a87a7ea1654c053cc48c06489785289f89bef407e539f8315185a8c5ca06aaafc59a
data/README.md CHANGED
@@ -689,6 +689,15 @@ For a few problematic videos, I have to apply options like `--force-rate 23.976
689
689
 
690
690
  ## History
691
691
 
692
+ ### [0.21.0](https://github.com/donmelton/video_transcoding/releases/tag/0.21.0)
693
+
694
+ Friday, November 9, 2018
695
+
696
+ * Modify `transcode-video` to create "sparse" `.log` files by removing overwritten progress information, often making those files an order of magnitude (i.e. `10x`) smaller. Via [ #213](https://github.com/donmelton/video_transcoding/issues/213).
697
+ * Replace code in `transcode-video` which used `mkvpropedit` or `mp4track` in a post-transcoding step to sanitize audio titles containing commas, with much simpler code leveraging a comma escaping mechanism only available in `HandBrakeCLI` version 1.0.0 or later.
698
+ * Fix bug in `transcode-video` where the level was not set when using the `x264_10bit` encoder.
699
+ * Remove support the non-existent `x265_16bit` encoder in `transcode-video`. This might have been available last year in some development builds of `HandBrakeCLI`, but it's definitely not in any release.
700
+
692
701
  ### [0.20.1](https://github.com/donmelton/video_transcoding/releases/tag/0.20.1)
693
702
 
694
703
  Sunday, October 21, 2018
data/bin/transcode-video CHANGED
@@ -801,13 +801,12 @@ HERE
801
801
  handbrake_options['title'] = title.to_s unless title == 1
802
802
  encoder_options = {}
803
803
  prepare_video(media, handbrake_options, encoder_options)
804
- renamed_audio = {}
805
- prepare_audio(media, handbrake_options, renamed_audio)
804
+ prepare_audio(media, handbrake_options)
806
805
  prepare_subtitle(media, handbrake_options)
807
806
  prepare_srt(media, handbrake_options)
808
807
  prepare_options(handbrake_options, encoder_options)
809
808
  transcode(handbrake_options)
810
- adjust_metadata(handbrake_options['output'], renamed_audio)
809
+ adjust_metadata(handbrake_options['output'])
811
810
 
812
811
  unless @dry_run
813
812
  seconds = Time.now.tv_sec - seconds
@@ -901,7 +900,18 @@ HERE
901
900
  end
902
901
 
903
902
  encoder = @handbrake_options.fetch('encoder', 'x264')
904
- return unless encoder =~ /^x264(?:_10bit)?$/ or encoder =~ /^x265(?:_1[026]bit)?$/
903
+ return unless encoder =~ /^x264(?:_10bit)?$/ or encoder =~ /^x265(?:_1[02]bit)?$/
904
+
905
+ case encoder
906
+ when 'x264'
907
+ handbrake_options['encoder-profile'] = 'high'
908
+ when 'x264_10bit'
909
+ handbrake_options['encoder-profile'] = 'high10'
910
+ when 'x265'
911
+ handbrake_options['encoder-profile'] = 'main'
912
+ when 'x265_10bit', 'x265_12bit'
913
+ handbrake_options['encoder-profile'] = 'main10'
914
+ end
905
915
 
906
916
  if width > 1920 or height > 1080
907
917
  encoder_level = '5.1'
@@ -917,19 +927,8 @@ HERE
917
927
  bitrate = @target_bitrate_480p
918
928
  end
919
929
 
920
- case encoder
921
- when 'x264'
922
- handbrake_options['encoder-profile'] = 'high'
923
-
924
- if @handbrake_options.fetch('rate', '30').to_f <= 30.0
930
+ if encoder =~ /^x264(?:_10bit)?$/ and @handbrake_options.fetch('rate', '30').to_f <= 30.0
925
931
  handbrake_options['encoder-level'] = encoder_level
926
- end
927
- when 'x264_10bit'
928
- handbrake_options['encoder-profile'] = 'high10'
929
- when 'x265'
930
- handbrake_options['encoder-profile'] = 'main'
931
- when 'x265_10bit', 'x265_12bit', 'x265_16bit'
932
- handbrake_options['encoder-profile'] = 'main10'
933
932
  end
934
933
 
935
934
  if @target_bitrate.nil?
@@ -955,7 +954,7 @@ HERE
955
954
  encoder_options['vbv-maxrate'] = ((bitrate * 1.5).to_i).to_s
956
955
  encoder_options['vbv-bufsize'] = ((bitrate * 2).to_i).to_s
957
956
  encoder_options['nal-hrd'] = 'vbr' if encoder =~ /^x264(?:_10bit)?$/
958
- encoder_options['hrd'] = '1' if encoder =~ /^x265(?:_1[026]bit)?$/
957
+ encoder_options['hrd'] = '1' if encoder =~ /^x265(?:_1[02]bit)?$/
959
958
  else
960
959
  handbrake_options['quality'] = '1'
961
960
  encoder_options['vbv-maxrate'] = bitrate.to_s
@@ -1011,7 +1010,7 @@ HERE
1011
1010
  end
1012
1011
  end
1013
1012
 
1014
- def prepare_audio(media, handbrake_options, renamed_audio)
1013
+ def prepare_audio(media, handbrake_options)
1015
1014
  return if @handbrake_options.fetch('audio', '') == 'none' or media.info[:audio].empty?
1016
1015
  main_track = resolve_main_audio(media)
1017
1016
  @audio_width[main_track] ||= @audio_width[:main]
@@ -1077,14 +1076,7 @@ HERE
1077
1076
  name = ''
1078
1077
  end
1079
1078
 
1080
- name = @audio_name.fetch(track, name)
1081
-
1082
- if name =~ /,/
1083
- sanitized_name = name.gsub(/,/, '_')
1084
- renamed_audio[sanitized_name] = name
1085
- name = sanitized_name
1086
- end
1087
-
1079
+ name = @audio_name.fetch(track, name).gsub(/,/, '","')
1088
1080
  names << name
1089
1081
 
1090
1082
  case @audio_width.fetch(track, @audio_width[:other])
@@ -1266,7 +1258,8 @@ HERE
1266
1258
  end
1267
1259
 
1268
1260
  Console.debug handbrake_command.inspect
1269
- log_file = @log ? File.new(handbrake_options['output'] + '.log', 'wb') : nil
1261
+ log_file_path = handbrake_options['output'] + '.log'
1262
+ log_file = @log ? File.new(log_file_path, 'wb') : nil
1270
1263
  Console.info 'Transcoding with HandBrakeCLI...'
1271
1264
 
1272
1265
  begin
@@ -1286,9 +1279,27 @@ HERE
1286
1279
 
1287
1280
  log_file.close unless log_file.nil?
1288
1281
  fail "transcoding failed: #{handbrake_options['input']}" unless $CHILD_STATUS.exitstatus == 0
1282
+
1283
+ unless log_file.nil?
1284
+ timestamp = File.mtime(log_file_path)
1285
+ content = ''
1286
+
1287
+ begin
1288
+ File.foreach(log_file_path) do |line|
1289
+ content += line
1290
+ end
1291
+ rescue SystemCallError => e
1292
+ raise "reading failed: #{e}"
1293
+ end
1294
+
1295
+ log_file = File.new(log_file_path, 'wb')
1296
+ log_file.print content.gsub(/^.*\r(.)/, '\1')
1297
+ log_file.close
1298
+ FileUtils.touch log_file_path, :mtime => timestamp
1299
+ end
1289
1300
  end
1290
1301
 
1291
- def adjust_metadata(output, renamed_audio)
1302
+ def adjust_metadata(output)
1292
1303
  return if @dry_run
1293
1304
  media = Media.new(path: output, allow_directory: false)
1294
1305
  Console.debug media.info.inspect
@@ -1316,56 +1327,6 @@ HERE
1316
1327
 
1317
1328
  fail "forcing subtitle: #{output}" if $CHILD_STATUS.exitstatus == 2
1318
1329
  end
1319
-
1320
- return if renamed_audio.empty?
1321
-
1322
- media.info[:audio].each do |track, info|
1323
- original_name = renamed_audio[info[:name]]
1324
-
1325
- unless original_name.nil?
1326
- if media.info[:mkv]
1327
- Console.info 'Renaming audio with mkvpropedit...'
1328
-
1329
- begin
1330
- IO.popen([
1331
- MKVpropedit.command_name,
1332
- '--edit', "track:a#{track}",
1333
- '--set', "name=#{original_name}",
1334
- output,
1335
- ], 'rb', :err=>[:child, :out]) do |io|
1336
- io.each do |line|
1337
- Console.debug line
1338
- end
1339
- end
1340
- rescue SystemCallError => e
1341
- raise "renaming audio failed: #{e}"
1342
- end
1343
-
1344
- fail "renaming audio: #{output}" if $CHILD_STATUS.exitstatus == 2
1345
- elsif media.info[:mp4]
1346
- Console.info 'Renaming audio with mp4track...'
1347
-
1348
- ['hdlrname', 'udtaname'].each do |property|
1349
- begin
1350
- IO.popen([
1351
- MP4track.command_name,
1352
- '--track-index', track.to_s,
1353
- "--#{property}", original_name,
1354
- output,
1355
- ], 'rb', :err=>[:child, :out]) do |io|
1356
- io.each do |line|
1357
- Console.debug line
1358
- end
1359
- end
1360
- rescue SystemCallError => e
1361
- raise "renaming audio failed: #{e}"
1362
- end
1363
-
1364
- fail "renaming audio: #{output}" unless $CHILD_STATUS.exitstatus == 0
1365
- end
1366
- end
1367
- end
1368
- end
1369
1330
  end
1370
1331
 
1371
1332
  def terminate
@@ -5,5 +5,5 @@
5
5
  #
6
6
 
7
7
  module VideoTranscoding
8
- VERSION = '0.20.1'
8
+ VERSION = '0.21.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.20.1
4
+ version: 0.21.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: 2018-10-21 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Video Transcoding is a package of tools to transcode, inspect
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  requirements: []
66
66
  rubyforge_project:
67
- rubygems_version: 2.7.6
67
+ rubygems_version: 2.7.7
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Tools to transcode, inspect and convert videos.