video_transcoding 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 2d7d919e24a5fca251194f942cda740d77abbad8
4
- data.tar.gz: c083259606760eeddfb2696bbf804ba28c7b3a07
3
+ metadata.gz: 1091a510ba22d9f6993cbf6d771543a0ac6186c8
4
+ data.tar.gz: 54b715df7da3d45652cd61616c38baa27439fa58
5
5
  SHA512:
6
- metadata.gz: f8bf3c064537725ee6c6c89b0e570a21366adb3c4957dc10296a2d9915dd62c079cb8ce286333e35deb5654273ac5faabcd9361e81d203614f03fbf69771cd56
7
- data.tar.gz: 663b007581e46bca80e38036864bc20cdda665219da8f73d45a5ef0407b7b8e5bcbad51c5084ffb3a9efa7bf9c1293a0143af36ca3d183f07539ee96eda52abc
6
+ metadata.gz: f8d958cd7f52b285858f6ec472bd30ed56ba56f6f075f6445cb280a69abac6e6febfa5a173e25cba0fc0abb3c251e91bcfa15d4a925ea67f4ebce89873738dd4
7
+ data.tar.gz: bcba09ac273d476e03b4d7d5196511a3e38d0fba14bf7cbe215d0c978861a6da7b21cb25e81837445aa256eda9082448c3d894647089ee2cc96fbc06ca480724
data/bin/transcode-video CHANGED
@@ -234,7 +234,7 @@ HERE
234
234
  @vbr_quality = nil
235
235
  @encoder_options = {}
236
236
  @disable_encoder_options = []
237
- @handbrake_options = {}
237
+ @handbrake_options = {'encoder-preset' => 'medium', 'encoder-profile' => 'high'}
238
238
  @disable_handbrake_options = []
239
239
  @temporary = nil
240
240
  end
@@ -297,15 +297,13 @@ HERE
297
297
 
298
298
  opts.on '--quick' do
299
299
  @quick = true
300
- @handbrake_options.delete 'encoder-preset'
300
+ force_handbrake_option 'encoder-preset', 'medium'
301
301
  end
302
302
 
303
303
  opts.on '--preset ARG' do |arg|
304
304
  case arg
305
- when 'medium'
306
- @handbrake_options.delete 'encoder-preset'
307
- when 'ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'slow',
308
- 'slower', 'veryslow', 'placebo'
305
+ when 'ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'medium',
306
+ 'slow', 'slower', 'veryslow', 'placebo'
309
307
  force_handbrake_option 'encoder-preset', arg
310
308
  else
311
309
  fail UsageError, "unsupported preset name: #{arg}"
@@ -604,10 +602,10 @@ HERE
604
602
  end
605
603
 
606
604
  opts.on '-E', '--encoder-option ARG' do |arg|
607
- if arg =~ /^([a-z][a-z_-]+)=([^ :]+)$/
605
+ if arg =~ /^([a-z0-9][a-z0-9_-]+)=([^ :]+)$/
608
606
  @encoder_options[$1] = $2
609
607
  @disable_encoder_options.delete $1
610
- elsif arg =~ /^_([a-z][a-z_-]+)$/
608
+ elsif arg =~ /^_([a-z0-9][a-z0-9_-]+)$/
611
609
  @disable_encoder_options << $1
612
610
  @encoder_options.delete $1
613
611
  else
@@ -770,25 +768,30 @@ HERE
770
768
 
771
769
  handbrake_options[anamorphic] = nil unless @handbrake_options.has_key? 'custom-anamorphic'
772
770
 
773
- if @abr_bitrate.nil? and @vbr_quality.nil?
774
- handbrake_options['quality'] = '16'
775
- preset = @handbrake_options.fetch('encoder-preset', 'medium')
771
+ if width > 1920 or height > 1080
772
+ handbrake_options['encoder-level'] = '5.1'
773
+ vbv_maxrate = @vbv_maxrate_2160p
774
+ elsif width > 1280 or height > 720
775
+ handbrake_options['encoder-level'] = '4.0'
776
+ vbv_maxrate = @vbv_maxrate_1080p
777
+ elsif width > 720 or height > 576
778
+ handbrake_options['encoder-level'] = '3.1'
779
+ vbv_maxrate = @vbv_maxrate_720p
780
+ else
781
+ handbrake_options['encoder-level'] = '3.0'
782
+ vbv_maxrate = @vbv_maxrate_480p
783
+ end
776
784
 
777
- if width > 1920 or height > 1080
778
- vbv_maxrate = @vbv_maxrate_2160p
779
- elsif width > 1280 or height > 720
780
- vbv_maxrate = @vbv_maxrate_1080p
785
+ preset = @handbrake_options.fetch('encoder-preset', 'medium')
781
786
 
782
- case preset
783
- when 'slow', 'slower', 'veryslow', 'placebo'
784
- handbrake_options['encoder-level'] = '4.0'
785
- end
786
- elsif width > 720 or height > 576
787
- vbv_maxrate = @vbv_maxrate_720p
788
- else
789
- vbv_maxrate = @vbv_maxrate_480p
787
+ if @abr_bitrate.nil? and @vbr_quality.nil?
788
+ case preset
789
+ when 'ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'medium'
790
+ handbrake_options['encoder-level'] = 'auto'
790
791
  end
791
792
 
793
+ handbrake_options['quality'] = '16'
794
+
792
795
  unless media.info[:directory]
793
796
  bitrate = ((((media.info[:size] * 8) / media.info[:duration]) / 1000) / 1000) * 1000
794
797
 
@@ -803,11 +806,6 @@ HERE
803
806
  end
804
807
  end
805
808
 
806
- case preset
807
- when 'slower', 'veryslow', 'placebo'
808
- encoder_options['ref'] = '5'
809
- end
810
-
811
809
  encoder_options['vbv-maxrate'] = vbv_maxrate.to_s
812
810
  encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', vbv_maxrate).to_i / 2).to_s
813
811
  encoder_options['crf-max'] = '25'
@@ -818,19 +816,9 @@ HERE
818
816
  end
819
817
 
820
818
  handbrake_options['quality'] = @vbr_quality.to_s.gsub(/\.0+$/, '') unless @vbr_quality.nil?
821
-
822
- if width > 1920 or height > 1080
823
- handbrake_options['encoder-level'] = '5.1'
824
- elsif width > 1280 or height > 720
825
- handbrake_options['encoder-level'] = '4.0'
826
- elsif width > 720 or height > 576
827
- handbrake_options['encoder-level'] = '3.1'
828
- else
829
- handbrake_options['encoder-level'] = '3.0'
830
- end
831
819
  end
832
820
 
833
- if @quick and not @handbrake_options.has_key? 'encoder-preset'
821
+ if @quick and preset == 'medium'
834
822
  encoder_options['ref'] = '1'
835
823
  encoder_options['weightp'] = '1'
836
824
  encoder_options['subme'] = '6'
@@ -1082,7 +1070,7 @@ HERE
1082
1070
  else
1083
1071
  files << file
1084
1072
  encodings << encoding
1085
- offsets << offsets
1073
+ offsets << offset
1086
1074
  languages << language
1087
1075
  end
1088
1076
  end
@@ -24,6 +24,16 @@ module VideoTranscoding
24
24
  end
25
25
  end
26
26
  end
27
+
28
+ begin
29
+ IO.popen([Tool.use(COMMAND_NAME), '--version'], :err=>[:child, :out]) do |io|
30
+ if io.read =~ /^HandBrake ([^ ]+)/
31
+ Console.info "#{$MATCH.strip} found..."
32
+ end
33
+ end
34
+ rescue SystemCallError => e
35
+ raise "#{COMMAND_NAME} failed during execution: #{e}"
36
+ end
27
37
  end
28
38
 
29
39
  def command_name
@@ -5,5 +5,5 @@
5
5
  #
6
6
 
7
7
  module VideoTranscoding
8
- VERSION = '0.3.0'
8
+ VERSION = '0.3.1'
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.3.0
4
+ version: 0.3.1
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-06 00:00:00.000000000 Z
11
+ date: 2016-01-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