video_transcoding 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ #
2
+ # mkvmerge.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ module MKVmerge
9
+ extend self
10
+
11
+ COMMAND_NAME = 'mkvmerge'
12
+
13
+ def setup
14
+ Tool.provide(COMMAND_NAME, ['--version']) do |output, status, _|
15
+ fail "#{COMMAND_NAME} failed during execution" unless status == 0
16
+
17
+ unless output =~ /^mkvmerge v([0-9.]+)/
18
+ Console.debug output
19
+ fail "#{COMMAND_NAME} version unknown"
20
+ end
21
+
22
+ version = $1
23
+ Console.info "#{$MATCH} found..."
24
+
25
+ unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 700
26
+ fail "#{COMMAND_NAME} version 7.0.0 or later required"
27
+ end
28
+ end
29
+ end
30
+
31
+ def command_name
32
+ Tool.use(COMMAND_NAME)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # mkvpropedit.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ module MKVpropedit
9
+ extend self
10
+
11
+ COMMAND_NAME = 'mkvpropedit'
12
+
13
+ def setup
14
+ Tool.provide(COMMAND_NAME, ['--version']) do |output, status, _|
15
+ fail "#{COMMAND_NAME} failed during execution" unless status == 0
16
+
17
+ unless output =~ /^mkvpropedit v([0-9.]+)/
18
+ Console.debug output
19
+ fail "#{COMMAND_NAME} version unknown"
20
+ end
21
+
22
+ version = $1
23
+ Console.info "#{$MATCH} found..."
24
+
25
+ unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 700
26
+ fail "#{COMMAND_NAME} version 7.0.0 or later required"
27
+ end
28
+ end
29
+ end
30
+
31
+ def command_name
32
+ Tool.use(COMMAND_NAME)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # mp4track.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ module MP4track
9
+ extend self
10
+
11
+ COMMAND_NAME = 'mp4track'
12
+
13
+ def setup
14
+ Tool.provide(COMMAND_NAME, ['--version']) do |output, status, _|
15
+ fail "#{COMMAND_NAME} failed during execution" unless status == 0
16
+
17
+ unless output =~ /^mp4track - MP4v2 ([0-9.]+)/
18
+ Console.debug output
19
+ fail "#{COMMAND_NAME} version unknown"
20
+ end
21
+
22
+ version = $1
23
+ Console.info "#{$MATCH} found..."
24
+
25
+ unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 200
26
+ fail "#{COMMAND_NAME} version 2.0.0 or later required"
27
+ end
28
+ end
29
+ end
30
+
31
+ def command_name
32
+ Tool.use(COMMAND_NAME)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,33 @@
1
+ #
2
+ # mplayer.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ module MPlayer
9
+ extend self
10
+
11
+ COMMAND_NAME = 'mplayer'
12
+
13
+ def setup
14
+ Tool.provide(COMMAND_NAME, ['-version']) do |output, _, _|
15
+ unless output =~ /^MPlayer ([0-9.]+)/
16
+ Console.debug output
17
+ fail "#{COMMAND_NAME} version unknown"
18
+ end
19
+
20
+ version = $1
21
+ Console.info "#{$MATCH} found..."
22
+
23
+ unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 101
24
+ fail "#{COMMAND_NAME} version 1.1 or later required"
25
+ end
26
+ end
27
+ end
28
+
29
+ def command_name
30
+ Tool.use(COMMAND_NAME)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,52 @@
1
+ #
2
+ # tool.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ class Tool
9
+ attr_reader :properties
10
+
11
+ def self.provide(command_name, test_args, &test_block)
12
+ fail "#{command_name} already provided" if @@tools.has_key? command_name
13
+ @@tools[command_name] = Tool.new(command_name, test_args, &test_block)
14
+ end
15
+
16
+ def self.use(command_name)
17
+ fail "#{command_name} not provided" unless @@tools.has_key? command_name
18
+ @@tools[command_name].prepare
19
+ command_name
20
+ end
21
+
22
+ def self.properties(command_name)
23
+ fail "#{command_name} not provided" unless @@tools.has_key? command_name
24
+ @@tools[command_name].prepare
25
+ @@tools[command_name].properties
26
+ end
27
+
28
+ def prepare
29
+ return if @ready
30
+ output = ''
31
+
32
+ begin
33
+ IO.popen([@command_name] + @test_args, :err=>[:child, :out]) { |io| output = io.read }
34
+ rescue Errno::ENOENT
35
+ raise "#{@command_name} not available"
36
+ end
37
+
38
+ @test_block.call output, $CHILD_STATUS.exitstatus, @properties
39
+ @ready = true
40
+ end
41
+
42
+ private
43
+
44
+ @@tools = {}
45
+
46
+ def initialize(command_name, test_args, &test_block)
47
+ @command_name, @test_args, @test_block = command_name, test_args, test_block
48
+ @properties = {}
49
+ @ready = false
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,9 @@
1
+ #
2
+ # version.rb
3
+ #
4
+ # Copyright (c) 2013-2015 Don Melton
5
+ #
6
+
7
+ module VideoTranscoding
8
+ VERSION = '0.1.0'
9
+ end
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
2
+
3
+ require 'video_transcoding'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'video_transcoding'
7
+ s.version = VideoTranscoding::VERSION
8
+ s.required_ruby_version = '>= 2.0'
9
+ s.summary = 'Tools to transcode, inspect and convert videos.'
10
+ s.description = <<-HERE
11
+ Video Transcoding is a package of tools to transcode, inspect
12
+ and convert videos.
13
+ HERE
14
+ s.license = 'MIT'
15
+ s.author = 'Don Melton'
16
+ s.email = 'don@blivet.com'
17
+ s.homepage = 'https://github.com/donmelton/video_transcoding'
18
+ s.files = Dir['{bin,lib}/**/*'] + Dir['[A-Z]*'] + ['video_transcoding.gemspec']
19
+ s.executables = ['convert-video', 'detect-crop', 'query-handbrake-log', 'transcode-video']
20
+ s.extra_rdoc_files = ['LICENSE', 'README.md']
21
+ s.require_paths = ['lib']
22
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: video_transcoding
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Don Melton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2
14
+ Video Transcoding is a package of tools to transcode, inspect
15
+ and convert videos.
16
+ email: don@blivet.com
17
+ executables:
18
+ - convert-video
19
+ - detect-crop
20
+ - query-handbrake-log
21
+ - transcode-video
22
+ extensions: []
23
+ extra_rdoc_files:
24
+ - LICENSE
25
+ - README.md
26
+ files:
27
+ - LICENSE
28
+ - README.md
29
+ - bin/convert-video
30
+ - bin/detect-crop
31
+ - bin/query-handbrake-log
32
+ - bin/transcode-video
33
+ - lib/video_transcoding.rb
34
+ - lib/video_transcoding/cli.rb
35
+ - lib/video_transcoding/console.rb
36
+ - lib/video_transcoding/copyright.rb
37
+ - lib/video_transcoding/crop.rb
38
+ - lib/video_transcoding/errors.rb
39
+ - lib/video_transcoding/ffmpeg.rb
40
+ - lib/video_transcoding/handbrake.rb
41
+ - lib/video_transcoding/media.rb
42
+ - lib/video_transcoding/mkvmerge.rb
43
+ - lib/video_transcoding/mkvpropedit.rb
44
+ - lib/video_transcoding/mp4track.rb
45
+ - lib/video_transcoding/mplayer.rb
46
+ - lib/video_transcoding/tool.rb
47
+ - lib/video_transcoding/version.rb
48
+ - video_transcoding.gemspec
49
+ homepage: https://github.com/donmelton/video_transcoding
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.4.5
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Tools to transcode, inspect and convert videos.
73
+ test_files: []