greatseth-mediainfo 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +1 -0
- data/LICENSE +18 -0
- data/Manifest +7 -0
- data/README.markdown +27 -0
- data/Rakefile +35 -0
- data/lib/mediainfo/attr_readers.rb +76 -0
- data/lib/mediainfo.rb +205 -0
- data/mediainfo.gemspec +34 -0
- data/test/mediainfo_awaywego_encoded_test.rb +269 -0
- data/test/mediainfo_awaywego_test.rb +273 -0
- data/test/mediainfo_dinner_test.rb +255 -0
- data/test/mediainfo_hats_test.rb +255 -0
- data/test/mediainfo_test.rb +84 -0
- data/test/mediainfo_vimeo_test.rb +255 -0
- data/test/mediainfo_vimeoimage_test.rb +234 -0
- data/test/test_helper.rb +17 -0
- metadata +92 -0
data/Changelog
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v0.1 Initial Release
|
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
This program is free software. It comes without any warranty, to
|
2
|
+
the extent permitted by applicable law. You can redistribute it
|
3
|
+
and/or modify it under the terms of the Do What The Fuck You Want
|
4
|
+
To Public License, Version 2, as published by Sam Hocevar. See
|
5
|
+
http://sam.zoy.org/wtfpl/COPYING for more details.
|
6
|
+
|
7
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
8
|
+
Version 2, December 2004
|
9
|
+
|
10
|
+
Copyright (C) 2009 Seth Thomas Rasmussen
|
11
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
12
|
+
copies of this license document, and changing it is allowed as long
|
13
|
+
as the name is changed.
|
14
|
+
|
15
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
16
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
17
|
+
|
18
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
data/Manifest
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Mediainfo
|
2
|
+
|
3
|
+
Mediainfo is a class encapsulating the ability to run `mediainfo`
|
4
|
+
on a file and expose the information it produces in a straightforward
|
5
|
+
manner.
|
6
|
+
|
7
|
+
The mediainfo CLI can be obtained at http://mediainfo.sourceforge.net.
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
info = Mediainfo.new "/path/to/file"
|
12
|
+
|
13
|
+
That will issue the system call to `mediainfo` and parse the output.
|
14
|
+
From there, you can call numerous methods to get a variety of information
|
15
|
+
about a file. Some attributes may be present for some files where others
|
16
|
+
are not.
|
17
|
+
|
18
|
+
For a list of all possible attributes supported:
|
19
|
+
|
20
|
+
Mediainfo.supported_attributes
|
21
|
+
|
22
|
+
In addition to the stock arguments provided by parsing `mediainfo` output,
|
23
|
+
some convenience methods and added behavior is added.
|
24
|
+
|
25
|
+
## Contributors
|
26
|
+
|
27
|
+
* Seth Thomas Rasmussen - http://greatseth.com
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "rake/testtask"
|
2
|
+
|
3
|
+
Rake::TestTask.new do |t|
|
4
|
+
t.libs << "test"
|
5
|
+
t.test_files = FileList["test/*_test.rb"]
|
6
|
+
t.verbose = true
|
7
|
+
end
|
8
|
+
|
9
|
+
task :default => :test
|
10
|
+
|
11
|
+
namespace :mediainfo do
|
12
|
+
task :fixture do
|
13
|
+
unless file = ENV["file"]
|
14
|
+
puts "Usage: rake mediainfo:fixture file=/path/to/file"
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
fixture = File.expand_path "./test/fixtures/#{File.basename file}.txt"
|
18
|
+
system "mediainfo #{file} > #{fixture}"
|
19
|
+
if File.exist? fixture
|
20
|
+
puts "Generated fixture #{fixture}."
|
21
|
+
else
|
22
|
+
puts "Error generating fixture. #{fixture} not created."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require "rubygems"
|
28
|
+
require "echoe"
|
29
|
+
|
30
|
+
Echoe.new "mediainfo" do |p|
|
31
|
+
p.author = "Seth Thomas Rasmussen"
|
32
|
+
p.email = "sethrasmussen@gmail.com"
|
33
|
+
p.url = "http://greatseth.com"
|
34
|
+
p.ignore_pattern = %w( test/**/* )
|
35
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "active_support" # TODO selective includes once they are released
|
3
|
+
|
4
|
+
class Mediainfo
|
5
|
+
module AttrReaders
|
6
|
+
def supported_attributes
|
7
|
+
@supported_attributes ||= []
|
8
|
+
end
|
9
|
+
|
10
|
+
def mediainfo_attr_reader(name, mediainfo_key = nil)
|
11
|
+
supported_attributes << name
|
12
|
+
attr_name = "#{name}_before_type_cast"
|
13
|
+
define_method attr_name do
|
14
|
+
if v = instance_variable_get("@#{attr_name}")
|
15
|
+
v
|
16
|
+
else
|
17
|
+
v = if md = name.to_s.match(/^(#{SECTIONS.map { |x| x.underscore } * "|"})_(.+)$/)
|
18
|
+
k = mediainfo_key ? mediainfo_key : md[2].humanize.capitalize
|
19
|
+
if subsection = @parsed_response[md[1].capitalize]
|
20
|
+
subsection[k]
|
21
|
+
end
|
22
|
+
else
|
23
|
+
k = mediainfo_key ? mediainfo_key : name.to_s.humanize.capitalize
|
24
|
+
@parsed_response[k]
|
25
|
+
end
|
26
|
+
|
27
|
+
instance_variable_set "@#{attr_name}", v
|
28
|
+
v
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
define_method name do
|
33
|
+
if v = instance_variable_get("@#{name}")
|
34
|
+
v
|
35
|
+
else
|
36
|
+
v = send "#{name}_before_type_cast"
|
37
|
+
v = yield v if v and block_given?
|
38
|
+
|
39
|
+
instance_variable_set "@#{name}", v
|
40
|
+
v
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def mediainfo_duration_reader(*a)
|
46
|
+
mediainfo_attr_reader *a do |v|
|
47
|
+
t = 0
|
48
|
+
v.split(/\s+/).each do |tf|
|
49
|
+
case tf
|
50
|
+
# XXX haven't actually seen hot they represent hours yet
|
51
|
+
# but hopefully this is ok.. :\
|
52
|
+
when /\d+h/ then t += tf.to_i * 60 * 60 * 1000
|
53
|
+
when /\d+mn/ then t += tf.to_i * 60 * 1000
|
54
|
+
when /\d+ms/ then t += tf.to_i
|
55
|
+
when /\d+s/ then t += tf.to_i * 1000
|
56
|
+
else
|
57
|
+
raise "unexpected time fragment! please report bug!"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
t
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def mediainfo_date_reader(*a)
|
65
|
+
mediainfo_attr_reader(*a) { |v| Time.parse v }
|
66
|
+
end
|
67
|
+
|
68
|
+
def mediainfo_int_reader(*a)
|
69
|
+
mediainfo_attr_reader(*a) { |v| v.gsub(/\D+/, "").to_i }
|
70
|
+
end
|
71
|
+
|
72
|
+
def mediainfo_section_query(name)
|
73
|
+
define_method("#{name}?") { @parsed_response.key? name.to_s.capitalize }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/mediainfo.rb
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
require "mediainfo/attr_readers"
|
2
|
+
|
3
|
+
# Mediainfo is a class encapsulating the ability to run `mediainfo`
|
4
|
+
# on a file and expose the information it produces in a straightforward
|
5
|
+
# manner.
|
6
|
+
#
|
7
|
+
# Basic usage:
|
8
|
+
#
|
9
|
+
# info = Mediainfo.new "/path/to/file"
|
10
|
+
#
|
11
|
+
# That will issue the system call to `mediainfo` and parse the output.
|
12
|
+
# From there, you can call numerous methods to get a variety of information
|
13
|
+
# about a file. Some attributes may be present for some files where others
|
14
|
+
# are not.
|
15
|
+
#
|
16
|
+
# For a list of all possible attributes supported:
|
17
|
+
#
|
18
|
+
# Mediainfo.supported_attributes
|
19
|
+
#
|
20
|
+
# In addition to the stock arguments provided by parsing `mediainfo` output,
|
21
|
+
# some convenience methods and added behavior is added.
|
22
|
+
class Mediainfo
|
23
|
+
extend AttrReaders
|
24
|
+
|
25
|
+
SECTIONS = %w( Audio Video Image ) # and General
|
26
|
+
|
27
|
+
### GENERAL
|
28
|
+
|
29
|
+
mediainfo_attr_reader :codec_id, "Codec ID"
|
30
|
+
|
31
|
+
mediainfo_duration_reader :duration
|
32
|
+
|
33
|
+
mediainfo_attr_reader :format
|
34
|
+
mediainfo_attr_reader :format_profile
|
35
|
+
mediainfo_attr_reader :format_info
|
36
|
+
mediainfo_attr_reader :overall_bit_rate
|
37
|
+
mediainfo_attr_reader :writing_application
|
38
|
+
mediainfo_attr_reader :writing_library
|
39
|
+
|
40
|
+
def size; File.size(@full_filename); end
|
41
|
+
|
42
|
+
mediainfo_date_reader :mastered_date
|
43
|
+
mediainfo_date_reader :tagged_date
|
44
|
+
mediainfo_date_reader :encoded_date
|
45
|
+
|
46
|
+
### VIDEO
|
47
|
+
|
48
|
+
mediainfo_section_query :video
|
49
|
+
|
50
|
+
# XXX this breaks from RVideo::Inspector which returns
|
51
|
+
# something like "#0.1" instead of "1"
|
52
|
+
mediainfo_attr_reader :video_stream_id, "ID"
|
53
|
+
|
54
|
+
mediainfo_duration_reader :video_duration
|
55
|
+
|
56
|
+
mediainfo_attr_reader :video_stream_size
|
57
|
+
mediainfo_attr_reader :video_bit_rate
|
58
|
+
mediainfo_attr_reader :video_nominal_bit_rate
|
59
|
+
|
60
|
+
mediainfo_attr_reader :video_bit_rate_mode
|
61
|
+
def cbr?; video? and "Constant" == video_bit_rate_mode; end
|
62
|
+
def vbr?; video? and not cbr?; end
|
63
|
+
|
64
|
+
mediainfo_attr_reader :video_scan_order
|
65
|
+
mediainfo_attr_reader :video_scan_type
|
66
|
+
def interlaced?; video? and "Interlaced" == video_scan_type; end
|
67
|
+
def progressive?; video? and not interlaced? end
|
68
|
+
|
69
|
+
mediainfo_int_reader :video_resolution
|
70
|
+
|
71
|
+
mediainfo_attr_reader :video_colorimetry
|
72
|
+
alias_method :video_colorspace, :video_colorimetry
|
73
|
+
|
74
|
+
mediainfo_attr_reader :video_format
|
75
|
+
mediainfo_attr_reader :video_format_profile
|
76
|
+
mediainfo_attr_reader :video_format_version
|
77
|
+
mediainfo_attr_reader :video_format_settings_cabac, "Format settings, CABAC"
|
78
|
+
mediainfo_attr_reader :video_format_settings_reframes, "Format settings, ReFrames"
|
79
|
+
mediainfo_attr_reader :video_format_settings_matrix, "Format settings, Matrix"
|
80
|
+
# Format settings, BVOP : Yes
|
81
|
+
# Format settings, QPel : No
|
82
|
+
# Format settings, GMC : No warppoints
|
83
|
+
# mediainfo_attr_reader :video_format_settings_qpel, "Format settings, QPel"
|
84
|
+
|
85
|
+
mediainfo_attr_reader :video_codec_id, "Codec ID"
|
86
|
+
mediainfo_attr_reader :video_codec_info, "Codec ID/Info"
|
87
|
+
|
88
|
+
mediainfo_attr_reader :video_frame_rate
|
89
|
+
def fps; video_frame_rate[/[\d.]+/].to_f if video?; end
|
90
|
+
alias_method :framerate, :fps
|
91
|
+
|
92
|
+
mediainfo_attr_reader :video_frame_rate_mode
|
93
|
+
|
94
|
+
mediainfo_attr_reader :video_display_aspect_ratio
|
95
|
+
alias_method :display_aspect_ratio, :video_display_aspect_ratio
|
96
|
+
|
97
|
+
mediainfo_attr_reader :video_bits_pixel_frame, "Bits/(Pixel*Frame)"
|
98
|
+
|
99
|
+
mediainfo_int_reader :video_width
|
100
|
+
mediainfo_int_reader :video_height
|
101
|
+
|
102
|
+
def resolution; "#{width}x#{height}" if video? or image?; end
|
103
|
+
def width; if video?; video_width; elsif image?; image_width; end; end
|
104
|
+
def height; if video?; video_height; elsif image?; image_height; end; end
|
105
|
+
|
106
|
+
mediainfo_date_reader :video_encoded_date
|
107
|
+
mediainfo_date_reader :video_tagged_date
|
108
|
+
|
109
|
+
### AUDIO
|
110
|
+
|
111
|
+
mediainfo_section_query :audio
|
112
|
+
|
113
|
+
# XXX this breaks from RVideo::Inspector which returns
|
114
|
+
# something like "#0.1" instead of "1"
|
115
|
+
mediainfo_attr_reader :audio_stream_id, "ID"
|
116
|
+
|
117
|
+
mediainfo_duration_reader :audio_duration
|
118
|
+
|
119
|
+
mediainfo_attr_reader :audio_sampling_rate
|
120
|
+
mediainfo_attr_reader :audio_stream_size
|
121
|
+
mediainfo_attr_reader :audio_bit_rate
|
122
|
+
mediainfo_attr_reader :audio_bit_rate_mode
|
123
|
+
mediainfo_attr_reader :audio_interleave_duration, "Interleave, duration"
|
124
|
+
|
125
|
+
mediainfo_int_reader :audio_resolution
|
126
|
+
alias_method :audio_sample_bit_depth, :audio_resolution
|
127
|
+
|
128
|
+
mediainfo_attr_reader :audio_format
|
129
|
+
mediainfo_attr_reader :audio_format_info, "Format/Info"
|
130
|
+
mediainfo_attr_reader :audio_format_settings_endianness, "Format settings, Endianness"
|
131
|
+
mediainfo_attr_reader :audio_format_settings_sign, "Format settings, Sign"
|
132
|
+
mediainfo_attr_reader :audio_codec_id, "Codec ID"
|
133
|
+
mediainfo_attr_reader :audio_codec_info, "Codec ID/Info"
|
134
|
+
mediainfo_attr_reader :audio_channel_positions
|
135
|
+
|
136
|
+
# XXX this breaks from RVideo::Inspector which returns
|
137
|
+
# strings like "mono" or "stereo" for this method.
|
138
|
+
mediainfo_int_reader :audio_channels, "Channel(s)"
|
139
|
+
def stereo?; 2 == audio_channels; end
|
140
|
+
def mono?; 1 == audio_channels; end
|
141
|
+
|
142
|
+
mediainfo_date_reader :audio_encoded_date
|
143
|
+
mediainfo_date_reader :audio_tagged_date
|
144
|
+
|
145
|
+
### IMAGE
|
146
|
+
|
147
|
+
mediainfo_section_query :image
|
148
|
+
mediainfo_attr_reader :image_resolution
|
149
|
+
mediainfo_attr_reader :image_format
|
150
|
+
|
151
|
+
mediainfo_int_reader :image_width
|
152
|
+
mediainfo_int_reader :image_height
|
153
|
+
|
154
|
+
###
|
155
|
+
|
156
|
+
attr_reader :raw_response, :parsed_response,
|
157
|
+
:full_filename, :filename, :path
|
158
|
+
|
159
|
+
def initialize(full_filename)
|
160
|
+
@mediainfo_binary = "mediainfo"
|
161
|
+
|
162
|
+
@full_filename = full_filename
|
163
|
+
@path = File.dirname @full_filename
|
164
|
+
@filename = File.basename @full_filename
|
165
|
+
|
166
|
+
raise ArgumentError, "need a path to a video file, got nil" unless @full_filename
|
167
|
+
raise ArgumentError, "need a path to a video file, #{@full_filename} does not exist" unless File.exist? @full_filename
|
168
|
+
|
169
|
+
@raw_response = mediainfo!
|
170
|
+
parse!
|
171
|
+
end
|
172
|
+
|
173
|
+
attr_accessor :mediainfo_binary
|
174
|
+
|
175
|
+
def mediainfo_version
|
176
|
+
`#{@mediainfo_binary} --Version`[/v([\d.]+)/, 1]
|
177
|
+
end
|
178
|
+
|
179
|
+
private
|
180
|
+
def mediainfo!
|
181
|
+
`#{@mediainfo_binary} #{@full_filename}`
|
182
|
+
end
|
183
|
+
|
184
|
+
def parse!
|
185
|
+
@parsed_response = {}
|
186
|
+
subsection = nil
|
187
|
+
|
188
|
+
@raw_response.split("\n").map { |x| x.strip }.each do |line|
|
189
|
+
next if line.empty? || line == "General"
|
190
|
+
|
191
|
+
if SECTIONS.include? line
|
192
|
+
subsection = line
|
193
|
+
@parsed_response[subsection] = {}
|
194
|
+
next
|
195
|
+
end
|
196
|
+
|
197
|
+
bucket = @parsed_response
|
198
|
+
bucket = bucket[subsection] if subsection
|
199
|
+
|
200
|
+
key, value = line.split(":", 2).map { |x| x.strip }
|
201
|
+
|
202
|
+
bucket[key] = value
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
data/mediainfo.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{mediainfo}
|
5
|
+
s.version = "0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Seth Thomas Rasmussen"]
|
9
|
+
s.date = %q{2009-05-10}
|
10
|
+
s.description = %q{}
|
11
|
+
s.email = %q{sethrasmussen@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["lib/mediainfo/attr_readers.rb", "lib/mediainfo.rb", "LICENSE", "README.markdown"]
|
13
|
+
s.files = ["Changelog", "lib/mediainfo/attr_readers.rb", "lib/mediainfo.rb", "LICENSE", "Manifest", "Rakefile", "README.markdown", "mediainfo.gemspec", "test/mediainfo_awaywego_encoded_test.rb", "test/mediainfo_awaywego_test.rb", "test/mediainfo_dinner_test.rb", "test/mediainfo_hats_test.rb", "test/mediainfo_test.rb", "test/mediainfo_vimeo_test.rb", "test/mediainfo_vimeoimage_test.rb", "test/test_helper.rb"]
|
14
|
+
s.homepage = %q{http://greatseth.com}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mediainfo", "--main", "README.markdown"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{mediainfo}
|
18
|
+
s.rubygems_version = %q{1.3.3}
|
19
|
+
s.summary = %q{}
|
20
|
+
s.test_files = ["test/mediainfo_awaywego_encoded_test.rb", "test/mediainfo_awaywego_test.rb", "test/mediainfo_dinner_test.rb", "test/mediainfo_hats_test.rb", "test/mediainfo_test.rb", "test/mediainfo_vimeo_test.rb", "test/mediainfo_vimeoimage_test.rb", "test/test_helper.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
28
|
+
else
|
29
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
30
|
+
end
|
31
|
+
else
|
32
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,269 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "mediainfo_test_helper"
|
3
|
+
|
4
|
+
class MediainfoAwaywegoEncodedTest < ActiveSupport::TestCase
|
5
|
+
def setup
|
6
|
+
@info = mediainfo_mock "AwayWeGo_24fps_253_15000_1920x840.mov"
|
7
|
+
end
|
8
|
+
|
9
|
+
### GENERAL
|
10
|
+
|
11
|
+
test "audio?" do
|
12
|
+
assert @info.audio?
|
13
|
+
end
|
14
|
+
|
15
|
+
test "video?" do
|
16
|
+
assert @info.video?
|
17
|
+
end
|
18
|
+
|
19
|
+
test "format" do
|
20
|
+
assert_equal "MPEG-PS", @info.format
|
21
|
+
end
|
22
|
+
|
23
|
+
test "format profile" do
|
24
|
+
assert_nil @info.format_profile
|
25
|
+
end
|
26
|
+
|
27
|
+
test "codec id" do
|
28
|
+
assert_nil @info.codec_id
|
29
|
+
end
|
30
|
+
|
31
|
+
mediainfo_test_size
|
32
|
+
|
33
|
+
test "duration" do
|
34
|
+
assert_equal 36224, @info.duration
|
35
|
+
assert_equal "36s 224ms", @info.duration_before_type_cast
|
36
|
+
end
|
37
|
+
|
38
|
+
test "overall bitrate" do
|
39
|
+
assert_equal "17.3 Mbps", @info.overall_bit_rate
|
40
|
+
end
|
41
|
+
|
42
|
+
test "encoded date" do
|
43
|
+
assert_nil @info.encoded_date
|
44
|
+
end
|
45
|
+
|
46
|
+
test "tagged date" do
|
47
|
+
assert_nil @info.tagged_date
|
48
|
+
end
|
49
|
+
|
50
|
+
test "writing application" do
|
51
|
+
assert_nil @info.writing_application
|
52
|
+
end
|
53
|
+
|
54
|
+
test "writing library" do
|
55
|
+
assert_nil @info.writing_library
|
56
|
+
end
|
57
|
+
|
58
|
+
### VIDEO
|
59
|
+
|
60
|
+
test "video stream id" do
|
61
|
+
assert_equal "224 (0xE0)", @info.video_stream_id
|
62
|
+
end
|
63
|
+
|
64
|
+
test "video Format" do
|
65
|
+
assert_equal "MPEG Video", @info.video_format
|
66
|
+
end
|
67
|
+
|
68
|
+
test "video format version" do
|
69
|
+
assert_equal "Version 2", @info.video_format_version
|
70
|
+
end
|
71
|
+
|
72
|
+
test "video format settings Matrix" do
|
73
|
+
assert_equal "Default", @info.video_format_settings_matrix
|
74
|
+
end
|
75
|
+
|
76
|
+
test "video format profile" do
|
77
|
+
assert_nil @info.video_format_profile
|
78
|
+
end
|
79
|
+
|
80
|
+
test "video format settings CABAC" do
|
81
|
+
assert_nil @info.video_format_settings_cabac
|
82
|
+
end
|
83
|
+
|
84
|
+
test "video format settings ReFrames" do
|
85
|
+
assert_nil @info.video_format_settings_reframes
|
86
|
+
end
|
87
|
+
|
88
|
+
test "video Codec ID" do
|
89
|
+
assert_nil @info.video_codec_id
|
90
|
+
end
|
91
|
+
|
92
|
+
test "video codec info" do
|
93
|
+
assert_nil @info.video_codec_info
|
94
|
+
end
|
95
|
+
|
96
|
+
test "video Duration" do
|
97
|
+
assert_equal 36202, @info.video_duration
|
98
|
+
assert_equal "36s 202ms", @info.video_duration_before_type_cast
|
99
|
+
end
|
100
|
+
|
101
|
+
test "video bit rate mode" do
|
102
|
+
assert_equal "Constant", @info.video_bit_rate_mode
|
103
|
+
assert !@info.vbr?
|
104
|
+
assert @info.cbr?
|
105
|
+
end
|
106
|
+
|
107
|
+
test "video Bit rate" do
|
108
|
+
assert_equal "16.0 Mbps", @info.video_bit_rate
|
109
|
+
end
|
110
|
+
|
111
|
+
test "video nominal bit rate" do
|
112
|
+
assert_equal "15.0 Mbps", @info.video_nominal_bit_rate
|
113
|
+
end
|
114
|
+
|
115
|
+
test "resolution" do
|
116
|
+
assert_equal "1920x1080", @info.resolution
|
117
|
+
end
|
118
|
+
|
119
|
+
test "video Width" do
|
120
|
+
assert_equal 1920, @info.video_width
|
121
|
+
assert_equal 1920, @info.width
|
122
|
+
end
|
123
|
+
|
124
|
+
test "video Height" do
|
125
|
+
assert_equal 1080, @info.video_height
|
126
|
+
assert_equal 1080, @info.height
|
127
|
+
end
|
128
|
+
|
129
|
+
test "video Display aspect ratio" do
|
130
|
+
assert_equal "16/9", @info.video_display_aspect_ratio
|
131
|
+
assert_equal "16/9", @info.display_aspect_ratio
|
132
|
+
end
|
133
|
+
|
134
|
+
test "video Frame rate" do
|
135
|
+
assert_equal "29.970 fps", @info.video_frame_rate
|
136
|
+
assert_equal 29.97, @info.fps
|
137
|
+
assert_equal 29.97, @info.framerate
|
138
|
+
end
|
139
|
+
|
140
|
+
test "video frame rate mode" do
|
141
|
+
assert_nil @info.video_frame_rate_mode
|
142
|
+
end
|
143
|
+
|
144
|
+
test "video Resolution" do
|
145
|
+
assert_nil @info.video_resolution
|
146
|
+
end
|
147
|
+
|
148
|
+
test "video colorimetry" do
|
149
|
+
assert_equal "4:2:2", @info.video_colorimetry
|
150
|
+
assert_equal "4:2:2", @info.video_colorspace
|
151
|
+
end
|
152
|
+
|
153
|
+
test "video Scan type" do
|
154
|
+
assert_equal "Interlaced", @info.video_scan_type
|
155
|
+
assert @info.interlaced?
|
156
|
+
assert !@info.progressive?
|
157
|
+
end
|
158
|
+
|
159
|
+
test "video scan order" do
|
160
|
+
assert_equal "Bottom Field First", @info.video_scan_order
|
161
|
+
end
|
162
|
+
|
163
|
+
test "video Bits/(Pixel*Frame)" do
|
164
|
+
assert_equal "0.258", @info.video_bits_pixel_frame
|
165
|
+
end
|
166
|
+
|
167
|
+
test "video Stream size" do
|
168
|
+
assert_nil @info.video_stream_size
|
169
|
+
end
|
170
|
+
|
171
|
+
test "video encoded date" do
|
172
|
+
assert_nil @info.video_encoded_date
|
173
|
+
# assert_equal "UTC 2009-03-30 19:57:50", @info.video_encoded_date
|
174
|
+
end
|
175
|
+
|
176
|
+
test "video tagged date" do
|
177
|
+
assert_nil @info.video_tagged_date
|
178
|
+
# assert_equal "UTC 2009-03-30 19:57:57", @info.video_tagged_date
|
179
|
+
end
|
180
|
+
|
181
|
+
### AUDIO
|
182
|
+
|
183
|
+
test "audio stream id" do
|
184
|
+
assert_equal "128 (0x80)", @info.audio_stream_id
|
185
|
+
end
|
186
|
+
|
187
|
+
test "audio Format" do
|
188
|
+
assert_equal "AC-3", @info.audio_format
|
189
|
+
end
|
190
|
+
|
191
|
+
test "audio format info" do
|
192
|
+
assert_equal "Audio Coding 3", @info.audio_format_info
|
193
|
+
end
|
194
|
+
|
195
|
+
test "audio Format settings, Endianness" do
|
196
|
+
assert_nil @info.audio_format_settings_endianness
|
197
|
+
end
|
198
|
+
|
199
|
+
test "audio Format settings, Sign" do
|
200
|
+
assert_nil @info.audio_format_settings_sign
|
201
|
+
end
|
202
|
+
|
203
|
+
test "audio Codec ID" do
|
204
|
+
assert_nil @info.audio_codec_id
|
205
|
+
end
|
206
|
+
|
207
|
+
test "audio Codec ID/Info" do
|
208
|
+
assert_nil @info.audio_codec_info
|
209
|
+
end
|
210
|
+
|
211
|
+
test "audio Duration" do
|
212
|
+
assert_equal 36224, @info.audio_duration
|
213
|
+
assert_equal "36s 224ms", @info.audio_duration_before_type_cast
|
214
|
+
end
|
215
|
+
|
216
|
+
test "audio Bit rate mode" do
|
217
|
+
assert_equal "Constant", @info.audio_bit_rate_mode
|
218
|
+
end
|
219
|
+
|
220
|
+
test "audio Bit rate" do
|
221
|
+
assert_equal "64.0 Kbps", @info.audio_bit_rate
|
222
|
+
end
|
223
|
+
|
224
|
+
test "audio Channel(s)" do
|
225
|
+
assert_equal 2, @info.audio_channels
|
226
|
+
end
|
227
|
+
|
228
|
+
test "audio channel positions" do
|
229
|
+
assert_equal "L R", @info.audio_channel_positions
|
230
|
+
end
|
231
|
+
|
232
|
+
test "stereo?" do
|
233
|
+
assert @info.stereo?
|
234
|
+
end
|
235
|
+
|
236
|
+
test "mono?" do
|
237
|
+
assert !@info.mono?
|
238
|
+
end
|
239
|
+
|
240
|
+
test "audio Sampling rate" do
|
241
|
+
assert_equal "48.0 KHz", @info.audio_sampling_rate
|
242
|
+
end
|
243
|
+
|
244
|
+
test "audio Resolution" do
|
245
|
+
assert_nil @info.audio_resolution
|
246
|
+
end
|
247
|
+
|
248
|
+
test "audio Stream size" do
|
249
|
+
assert_nil @info.audio_stream_size
|
250
|
+
end
|
251
|
+
|
252
|
+
test "audio Interleave, duration" do
|
253
|
+
assert_nil @info.audio_interleave_duration
|
254
|
+
end
|
255
|
+
|
256
|
+
test "audio encoded date" do
|
257
|
+
assert_nil @info.audio_encoded_date
|
258
|
+
# assert_equal "UTC 2009-03-30 19:57:50", @info.audio_encoded_date
|
259
|
+
end
|
260
|
+
|
261
|
+
test "audio tagged date" do
|
262
|
+
assert_nil @info.audio_tagged_date
|
263
|
+
# assert_equal "UTC 2009-03-30 19:57:57", @info.audio_tagged_date
|
264
|
+
end
|
265
|
+
|
266
|
+
### IMAGE
|
267
|
+
|
268
|
+
mediainfo_test_not_an_image
|
269
|
+
end
|