video_transcoding 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b5adafe5bd6c4a00292c1612441c6c7eb8b4802
4
- data.tar.gz: 32aa6c3d0ac955af512d5df074c7a2574d715138
3
+ metadata.gz: 2d7d919e24a5fca251194f942cda740d77abbad8
4
+ data.tar.gz: c083259606760eeddfb2696bbf804ba28c7b3a07
5
5
  SHA512:
6
- metadata.gz: 8acab588ee097fb887826a185e9b61c82de05ebce05163e2ba7d01044fb38da3cd6840de96391296dd5d5ef43ff34b70594fcca124f6bc0fd5e3154689f92a56
7
- data.tar.gz: 135a462f956264ec61d47c02814e122e694bfcf47ecade0182519f157b1d7a2a3002595f3487aecfb96d018139298c9084191004e95ee10b3b4aa0e820994b57
6
+ metadata.gz: f8bf3c064537725ee6c6c89b0e570a21366adb3c4957dc10296a2d9915dd62c079cb8ce286333e35deb5654273ac5faabcd9361e81d203614f03fbf69771cd56
7
+ data.tar.gz: 663b007581e46bca80e38036864bc20cdda665219da8f73d45a5ef0407b7b8e5bcbad51c5084ffb3a9efa7bf9c1293a0143af36ca3d183f07539ee96eda52abc
data/bin/convert-video CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # convert-video
4
4
  #
5
- # Copyright (c) 2013-2015 Don Melton
5
+ # Copyright (c) 2013-2016 Don Melton
6
6
  #
7
7
 
8
8
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
data/bin/detect-crop CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # detect-crop
4
4
  #
5
- # Copyright (c) 2013-2015 Don Melton
5
+ # Copyright (c) 2013-2016 Don Melton
6
6
  #
7
7
 
8
8
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # query-handbrake-log
4
4
  #
5
- # Copyright (c) 2013-2015 Don Melton
5
+ # Copyright (c) 2013-2016 Don Melton
6
6
  #
7
7
 
8
8
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
data/bin/transcode-video CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # transcode-video
4
4
  #
5
- # Copyright (c) 2013-2015 Don Melton
5
+ # Copyright (c) 2013-2016 Don Melton
6
6
  #
7
7
 
8
8
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
@@ -163,6 +163,10 @@ External subtitle options:
163
163
  to previously burned, forced or added subtitle
164
164
  (can be used multiple times)
165
165
 
166
+ Alternate ratecontrol options:
167
+ --abr BITRATE use modified ABR ratecontrol with average video bitrate
168
+ --vbr QUALITY use true VBR ratecontrol with constant video quality (0-51)
169
+
166
170
  Advanced options:
167
171
  -E, --encoder-option NAME=VALUE|_NAME
168
172
  pass x264 video encoder option by name with value
@@ -226,6 +230,8 @@ HERE
226
230
  @srt_language = {}
227
231
  @srt_encoding = {}
228
232
  @srt_offset = {}
233
+ @abr_bitrate = nil
234
+ @vbr_quality = nil
229
235
  @encoder_options = {}
230
236
  @disable_encoder_options = []
231
237
  @handbrake_options = {}
@@ -587,6 +593,16 @@ HERE
587
593
  @srt_offset[@srt_file.size - 1] = arg
588
594
  end
589
595
 
596
+ opts.on '--abr ARG', Integer do |arg|
597
+ @abr_bitrate = arg
598
+ @vbr_quality = nil
599
+ end
600
+
601
+ opts.on '--vbr ARG', Float do |arg|
602
+ @vbr_quality = arg
603
+ @abr_bitrate = nil
604
+ end
605
+
590
606
  opts.on '-E', '--encoder-option ARG' do |arg|
591
607
  if arg =~ /^([a-z][a-z_-]+)=([^ :]+)$/
592
608
  @encoder_options[$1] = $2
@@ -676,8 +692,7 @@ HERE
676
692
  'input' => arg,
677
693
  'output' => resolve_output(media),
678
694
  'markers' => nil,
679
- 'encoder' => 'x264',
680
- 'quality' => '16'
695
+ 'encoder' => 'x264'
681
696
  }
682
697
  title = media.info[:title]
683
698
  handbrake_options['title'] = title.to_s unless title == 1
@@ -754,45 +769,66 @@ HERE
754
769
  end
755
770
 
756
771
  handbrake_options[anamorphic] = nil unless @handbrake_options.has_key? 'custom-anamorphic'
757
- preset = @handbrake_options.fetch('encoder-preset', 'medium')
758
772
 
759
- if width > 1920 or height > 1080
760
- vbv_maxrate = @vbv_maxrate_2160p
761
- elsif width > 1280 or height > 720
762
- vbv_maxrate = @vbv_maxrate_1080p
773
+ if @abr_bitrate.nil? and @vbr_quality.nil?
774
+ handbrake_options['quality'] = '16'
775
+ preset = @handbrake_options.fetch('encoder-preset', 'medium')
763
776
 
764
- case preset
765
- when 'slow', 'slower', 'veryslow', 'placebo'
766
- handbrake_options['encoder-level'] = '4.0'
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
781
+
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
767
790
  end
768
- elsif width > 720 or height > 576
769
- vbv_maxrate = @vbv_maxrate_720p
770
- else
771
- vbv_maxrate = @vbv_maxrate_480p
772
- end
773
791
 
774
- unless media.info[:directory]
775
- bitrate = ((((media.info[:size] * 8) / media.info[:duration]) / 1000) / 1000) * 1000
792
+ unless media.info[:directory]
793
+ bitrate = ((((media.info[:size] * 8) / media.info[:duration]) / 1000) / 1000) * 1000
776
794
 
777
- if bitrate < vbv_maxrate
778
- min_bitrate = vbv_maxrate / 2
795
+ if bitrate < vbv_maxrate
796
+ min_bitrate = vbv_maxrate / 2
779
797
 
780
- if bitrate < min_bitrate
781
- vbv_maxrate = min_bitrate
782
- else
783
- vbv_maxrate = bitrate
798
+ if bitrate < min_bitrate
799
+ vbv_maxrate = min_bitrate
800
+ else
801
+ vbv_maxrate = bitrate
802
+ end
784
803
  end
785
804
  end
786
- end
787
805
 
788
- case preset
789
- when 'slower', 'veryslow', 'placebo'
790
- encoder_options['ref'] = '5'
791
- end
806
+ case preset
807
+ when 'slower', 'veryslow', 'placebo'
808
+ encoder_options['ref'] = '5'
809
+ end
810
+
811
+ encoder_options['vbv-maxrate'] = vbv_maxrate.to_s
812
+ encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', vbv_maxrate).to_i / 2).to_s
813
+ encoder_options['crf-max'] = '25'
814
+ else
815
+ unless @abr_bitrate.nil?
816
+ handbrake_options['vb'] = @abr_bitrate.to_s
817
+ encoder_options['qpmax'] = '34'
818
+ end
792
819
 
793
- encoder_options['vbv-maxrate'] = vbv_maxrate.to_s
794
- encoder_options['vbv-bufsize'] = (@encoder_options.fetch('vbv-maxrate', vbv_maxrate).to_i / 2).to_s
795
- encoder_options['crf-max'] = '25'
820
+ 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
+ end
796
832
 
797
833
  if @quick and not @handbrake_options.has_key? 'encoder-preset'
798
834
  encoder_options['ref'] = '1'
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # cli.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  require 'optparse'
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # console.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,9 +1,9 @@
1
1
  #
2
2
  # copyright.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
8
- COPYRIGHT = 'Copyright (c) 2013-2015 Don Melton'
8
+ COPYRIGHT = 'Copyright (c) 2013-2016 Don Melton'
9
9
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # crop.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # errors.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # ffmpeg.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # media.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # mkvmerge.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # mkvpropedit.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # mplayer.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # tool.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  module VideoTranscoding
@@ -5,5 +5,5 @@
5
5
  #
6
6
 
7
7
  module VideoTranscoding
8
- VERSION = '0.2.8'
8
+ VERSION = '0.3.0'
9
9
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # video_transcoding.rb
3
3
  #
4
- # Copyright (c) 2013-2015 Don Melton
4
+ # Copyright (c) 2013-2016 Don Melton
5
5
  #
6
6
 
7
7
  require 'English'
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.2.8
4
+ version: 0.3.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-05 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Video Transcoding is a package of tools to transcode, inspect