mkv2m4v 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/bin/mkv2m4v +4 -0
- data/lib/mkv2m4v/mediainfo.rb +13 -0
- data/lib/mkv2m4v/version.rb +15 -0
- data/lib/mkv2m4v.rb +75 -0
- data/mkv2m4v.gemspec +22 -0
- metadata +93 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Ryan McGeary
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
**This gem is a work in progress.** Do not expect any supported functionality
|
2
|
+
until v0.1.0.
|
3
|
+
|
4
|
+
# mkv2m4v
|
5
|
+
|
6
|
+
Converts audio and video tracks from a MKV (Matroska Media) container into a
|
7
|
+
format compatible with Apple TVs.
|
8
|
+
|
9
|
+
It attempts to pass through as many codecs as possible.
|
10
|
+
|
11
|
+
* It assumes that the video track is already in H.264/MPEG-4 (Advanced Video
|
12
|
+
Codec).
|
13
|
+
* It will convert a DTS audio track into separate AAC and AC3 tracks.
|
14
|
+
* If no DTS, it will pass through the original AAC and/or AC3 tracks.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
$ brew install mediainfo
|
19
|
+
$ gem install mkv2m4v
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
$ mkv2m4v some-video.mkv
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/mkv2m4v
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Mkv2m4v
|
2
|
+
VERSION = "0.0.1"
|
3
|
+
|
4
|
+
VersionDescription = "mkv2m4v #{VERSION} (c) 2012 Ryan McGeary"
|
5
|
+
Description = <<EOS
|
6
|
+
mkv2m4v is a command line utility that converts audio and video tracks from a
|
7
|
+
MKV (Matroska Media) container into a format compatible with Apple TVs.
|
8
|
+
EOS
|
9
|
+
Usage = <<EOS
|
10
|
+
Usage:
|
11
|
+
mkv2m4v [options] <filenames>+
|
12
|
+
|
13
|
+
Options:
|
14
|
+
EOS
|
15
|
+
end
|
data/lib/mkv2m4v.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require "mkv2m4v/version"
|
2
|
+
require "mkv2m4v/mediainfo"
|
3
|
+
require "trollop"
|
4
|
+
|
5
|
+
module Mkv2m4v
|
6
|
+
class Command
|
7
|
+
def initialize
|
8
|
+
parse_options
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
if @options[:info]
|
13
|
+
print_info
|
14
|
+
else
|
15
|
+
convert_files
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def convert_files
|
22
|
+
$stderr.puts "Converting files is not yet supported. For now, try the --info option."
|
23
|
+
# each_file do |file|
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_info
|
28
|
+
each_file do |file|
|
29
|
+
info = Mediainfo.new file
|
30
|
+
puts "#{info.general.format}: #{file}"
|
31
|
+
info.video.count.times do |i|
|
32
|
+
print_video_track(info.video[i])
|
33
|
+
end
|
34
|
+
info.audio.count.times do |i|
|
35
|
+
print_audio_track(info.audio[i])
|
36
|
+
end
|
37
|
+
puts
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def print_video_track(video)
|
42
|
+
puts "Video Track #{video.stream_id}:"
|
43
|
+
puts " Format: #{video.format} (#{video.format_info}, #{video.codec_id})"
|
44
|
+
puts " Resolution: #{video.frame_size}#{video.interlaced? ? "i" : "p"}"
|
45
|
+
puts " FPS: #{video.fps}"
|
46
|
+
puts " Language: #{video.language}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def print_audio_track(audio)
|
50
|
+
puts "Audio Track #{audio.stream_id}:"
|
51
|
+
puts " Format: #{audio.format} (#{audio.format_info}, #{audio.codec_id})"
|
52
|
+
puts " Channels: #{audio.channel_count} (#{audio.channel_positions})"
|
53
|
+
puts " Language: #{audio.language}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def each_file
|
57
|
+
ARGV.each do |file|
|
58
|
+
if File.exists?(file)
|
59
|
+
yield file
|
60
|
+
else
|
61
|
+
$stderr.puts "#{file} does not exist."
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def parse_options
|
67
|
+
usage = usage
|
68
|
+
@options = Trollop::options do
|
69
|
+
version Mkv2m4v::VersionDescription
|
70
|
+
banner [Mkv2m4v::Description, Mkv2m4v::Usage].join("\n")
|
71
|
+
opt :info, "Print media info only"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/mkv2m4v.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mkv2m4v/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "mkv2m4v"
|
8
|
+
gem.version = Mkv2m4v::VERSION
|
9
|
+
gem.authors = ["Ryan McGeary"]
|
10
|
+
gem.email = ["ryan@mcgeary.org"]
|
11
|
+
gem.description = Mkv2m4v::Description
|
12
|
+
gem.summary = %q{Makes Apple TV compatible videos}
|
13
|
+
gem.homepage = "https://github.com/rmm5t/mkv2m4v"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency("trollop", "~> 2.0")
|
21
|
+
gem.add_dependency("mediainfo", "~> 0.7")
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mkv2m4v
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan McGeary
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
none: false
|
21
|
+
name: trollop
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '2.0'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0.7'
|
36
|
+
none: false
|
37
|
+
name: mediainfo
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0.7'
|
45
|
+
none: false
|
46
|
+
description: ! 'mkv2m4v is a command line utility that converts audio and video tracks
|
47
|
+
from a
|
48
|
+
|
49
|
+
MKV (Matroska Media) container into a format compatible with Apple TVs.
|
50
|
+
|
51
|
+
'
|
52
|
+
email:
|
53
|
+
- ryan@mcgeary.org
|
54
|
+
executables:
|
55
|
+
- mkv2m4v
|
56
|
+
extensions: []
|
57
|
+
extra_rdoc_files: []
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- bin/mkv2m4v
|
65
|
+
- lib/mkv2m4v.rb
|
66
|
+
- lib/mkv2m4v/mediainfo.rb
|
67
|
+
- lib/mkv2m4v/version.rb
|
68
|
+
- mkv2m4v.gemspec
|
69
|
+
homepage: https://github.com/rmm5t/mkv2m4v
|
70
|
+
licenses: []
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
none: false
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
none: false
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.23
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Makes Apple TV compatible videos
|
93
|
+
test_files: []
|