media_info 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/media_info.rb +89 -0
- data/lib/media_info/parser.rb +79 -0
- data/lib/media_info/stream.rb +109 -0
- data/lib/media_info/stream_factory.rb +21 -0
- data/lib/media_info/streams/audio.rb +93 -0
- data/lib/media_info/streams/general.rb +56 -0
- data/lib/media_info/streams/image.rb +38 -0
- data/lib/media_info/streams/menu.rb +57 -0
- data/lib/media_info/streams/other.rb +9 -0
- data/lib/media_info/streams/text.rb +7 -0
- data/lib/media_info/streams/video.rb +158 -0
- data/lib/media_info/version.rb +10 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a27fd9d51e03db397ca6587a2cff5cbf985aa80
|
4
|
+
data.tar.gz: 20b835fcba806eeaeee8f82230809961edaa9849
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5234d12da535a1b0fbd850bde23db0bacc7e85ea44788bc0f8a4e7e846a265b23c8a71c08a4f6e133ea9ad44019aaecbd73ca2b1c864bffd3f59a0fce9ee8171
|
7
|
+
data.tar.gz: 12d3d23d5f6314bb247cf7af6554388f91f08a47bb6ef38ef7db7d550dc422361aa90660b96d0a703fae3877f16af355046754acce053af396ba4971bf0efb77
|
data/lib/media_info.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'media_info/parser'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class Base
|
5
|
+
attr_reader :streams
|
6
|
+
|
7
|
+
def initialize(filename)
|
8
|
+
check_file(filename)
|
9
|
+
|
10
|
+
@streams = Parser.call(filename)
|
11
|
+
end
|
12
|
+
|
13
|
+
def streams_types
|
14
|
+
streams.map do |stream|
|
15
|
+
stream.class::TYPE
|
16
|
+
end.uniq
|
17
|
+
end
|
18
|
+
|
19
|
+
def general?
|
20
|
+
stream?(:general)
|
21
|
+
end
|
22
|
+
|
23
|
+
def video?
|
24
|
+
stream?(:video)
|
25
|
+
end
|
26
|
+
|
27
|
+
def audio?
|
28
|
+
stream?(:audio)
|
29
|
+
end
|
30
|
+
|
31
|
+
def text?
|
32
|
+
stream?(:text)
|
33
|
+
end
|
34
|
+
|
35
|
+
def image?
|
36
|
+
stream?(:image)
|
37
|
+
end
|
38
|
+
|
39
|
+
def menu?
|
40
|
+
stream?(:menu)
|
41
|
+
end
|
42
|
+
|
43
|
+
def other?
|
44
|
+
stream?(:other)
|
45
|
+
end
|
46
|
+
|
47
|
+
def general
|
48
|
+
search_stream(:general)
|
49
|
+
end
|
50
|
+
|
51
|
+
def video
|
52
|
+
search_stream(:video)
|
53
|
+
end
|
54
|
+
|
55
|
+
def audio
|
56
|
+
search_stream(:audio)
|
57
|
+
end
|
58
|
+
|
59
|
+
def text
|
60
|
+
search_stream(:text)
|
61
|
+
end
|
62
|
+
|
63
|
+
def image
|
64
|
+
search_stream(:image)
|
65
|
+
end
|
66
|
+
|
67
|
+
def menu
|
68
|
+
search_stream(:menu)
|
69
|
+
end
|
70
|
+
|
71
|
+
def other
|
72
|
+
search_stream(:other)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def stream?(type)
|
78
|
+
streams.any? { |stream| stream.class::TYPE == type }
|
79
|
+
end
|
80
|
+
|
81
|
+
def search_stream(type)
|
82
|
+
streams.select { |stream| stream.class::TYPE == type }
|
83
|
+
end
|
84
|
+
|
85
|
+
def check_file(file_path)
|
86
|
+
raise ArgumentError, "#{file_path} does not exist or is not local file" unless File.exist?(file_path)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'English'
|
2
|
+
require 'rexml/document'
|
3
|
+
require 'media_info/stream_factory'
|
4
|
+
|
5
|
+
module MediaInfo
|
6
|
+
class Parser
|
7
|
+
def self.call(file_path)
|
8
|
+
new(file_path).parse
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :file_path
|
12
|
+
|
13
|
+
def initialize(file_path)
|
14
|
+
@file_path = file_path
|
15
|
+
|
16
|
+
# check for MediaInfo CLI
|
17
|
+
raise StandardError, 'mediainfo command-line interface not installed' unless cli_available?
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse
|
21
|
+
raw_xml_response = execute_command
|
22
|
+
|
23
|
+
raise "Execution of `#{command}` failed: #{raw_xml_response.inspect}" unless $CHILD_STATUS.success?
|
24
|
+
|
25
|
+
create_streams(raw_xml_response)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def command
|
31
|
+
"#{cli_path} '#{file_path}' --Full --Language=raw --BOM --Output=XML"
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute_command
|
35
|
+
%x(echo `#{command} 2>&1`)
|
36
|
+
end
|
37
|
+
|
38
|
+
def cli_path
|
39
|
+
%x(echo `which mediainfo`).strip
|
40
|
+
end
|
41
|
+
|
42
|
+
def cli_available?
|
43
|
+
!cli_path.empty? && File.exist?(File.expand_path(cli_path))
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_streams(raw_xml_response)
|
47
|
+
parse_xml_tracks(raw_xml_response).map do |track|
|
48
|
+
elements = make_elements_hash(
|
49
|
+
track.children.select { |child| child.is_a? REXML::Element }
|
50
|
+
)
|
51
|
+
|
52
|
+
StreamFactory.create(track.attributes['type'], elements)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def parse_xml_tracks(raw_xml)
|
57
|
+
REXML::Document.new(raw_xml).elements.to_a('/Mediainfo/File/track')
|
58
|
+
end
|
59
|
+
|
60
|
+
def make_elements_hash(children)
|
61
|
+
children.each_with_object({}) do |element, memo|
|
62
|
+
tag_name = convert_element_name(element.name).to_sym
|
63
|
+
memo[tag_name] = element.text.strip
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Convert MediaInfo attribute name to Ruby style
|
68
|
+
# eg: Image_Format_WithHint_List to image_format_with_hint_list
|
69
|
+
def convert_element_name(tag_name)
|
70
|
+
# add underscore between capital case
|
71
|
+
tag_name = tag_name.gsub(/(.)([A-Z])/, '\1_\2')
|
72
|
+
# replace several '_' following by a single one
|
73
|
+
tag_name = tag_name.gsub(/_+/, '_')
|
74
|
+
tag_name = tag_name.downcase
|
75
|
+
|
76
|
+
tag_name
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Separate to Streams and Attributes defined in
|
2
|
+
# https://github.com/MediaArea/MediaInfoLib/blob/master/Source/MediaInfo/File__Analyse_Automatic.h
|
3
|
+
|
4
|
+
require 'time'
|
5
|
+
|
6
|
+
module MediaInfo
|
7
|
+
class Stream
|
8
|
+
attr_reader :count,
|
9
|
+
:status,
|
10
|
+
:stream_count,
|
11
|
+
:stream_kind,
|
12
|
+
:stream_kind_string,
|
13
|
+
:stream_kind_id,
|
14
|
+
:stream_kind_pos,
|
15
|
+
:stream_order,
|
16
|
+
:first_packet_order,
|
17
|
+
:inform,
|
18
|
+
:id,
|
19
|
+
:id_string,
|
20
|
+
:unique_id,
|
21
|
+
:unique_id_string,
|
22
|
+
:format,
|
23
|
+
:format_info,
|
24
|
+
:format_url,
|
25
|
+
:format_extensions,
|
26
|
+
:format_commercial,
|
27
|
+
:format_commercial_if_any,
|
28
|
+
:format_version,
|
29
|
+
:format_profile,
|
30
|
+
:format_compression,
|
31
|
+
:format_settings,
|
32
|
+
:internet_media_type,
|
33
|
+
:codec,
|
34
|
+
:codec_string,
|
35
|
+
:codec_extensions,
|
36
|
+
:codec_id,
|
37
|
+
:codec_id_string,
|
38
|
+
:codec_id_info,
|
39
|
+
:codec_id_hint,
|
40
|
+
:codec_id_url,
|
41
|
+
:codec_id_description,
|
42
|
+
:stream_size,
|
43
|
+
:stream_size_string,
|
44
|
+
:stream_size_string1,
|
45
|
+
:stream_size_string2,
|
46
|
+
:stream_size_string3,
|
47
|
+
:stream_size_string4,
|
48
|
+
:stream_size_string5,
|
49
|
+
:stream_size_proportion,
|
50
|
+
:_others
|
51
|
+
|
52
|
+
alias stream_id id
|
53
|
+
|
54
|
+
def initialize(params = {})
|
55
|
+
@_others = {}
|
56
|
+
|
57
|
+
params.each do |key, value|
|
58
|
+
unless respond_to?(key)
|
59
|
+
@_others.merge!(Hash[key, value])
|
60
|
+
next
|
61
|
+
end
|
62
|
+
|
63
|
+
if respond_to?("#{key}=", true)
|
64
|
+
send("#{key}=", value)
|
65
|
+
else
|
66
|
+
instance_variable_set("@#{key}", value)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def count=(value)
|
74
|
+
@count = value.to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
def stream_count=(value)
|
78
|
+
@stream_count = value.to_i
|
79
|
+
end
|
80
|
+
|
81
|
+
def stream_kind_id=(value)
|
82
|
+
@stream_kind_id = value.to_i
|
83
|
+
end
|
84
|
+
|
85
|
+
def first_packet_order=(value)
|
86
|
+
@first_packet_order = value.to_i
|
87
|
+
end
|
88
|
+
|
89
|
+
def format_extensions=(value)
|
90
|
+
@format_extensions = value.split(split_delimiter)
|
91
|
+
end
|
92
|
+
|
93
|
+
def codec_extensions=(value)
|
94
|
+
@codec_extensions = value.split(split_delimiter)
|
95
|
+
end
|
96
|
+
|
97
|
+
def stream_size=(value)
|
98
|
+
@stream_size = value.to_i
|
99
|
+
end
|
100
|
+
|
101
|
+
def stream_size_proportion=(value)
|
102
|
+
@stream_size_proportion = value.to_f
|
103
|
+
end
|
104
|
+
|
105
|
+
def split_delimiter
|
106
|
+
/[\s,']/
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'media_info/streams/audio'
|
2
|
+
require 'media_info/streams/video'
|
3
|
+
require 'media_info/streams/text'
|
4
|
+
require 'media_info/streams/image'
|
5
|
+
require 'media_info/streams/general'
|
6
|
+
require 'media_info/streams/menu'
|
7
|
+
require 'media_info/streams/other'
|
8
|
+
|
9
|
+
module MediaInfo
|
10
|
+
module StreamFactory
|
11
|
+
def self.create(stream_type, params)
|
12
|
+
raise ArgumentError, "Need a stream_type, received #{stream_type.inspect}" if stream_type.nil?
|
13
|
+
|
14
|
+
# we check that there is a subclass of stream for this stream
|
15
|
+
stream_class_name = "MediaInfo::#{stream_type}Stream"
|
16
|
+
raise "Bad stream type: #{stream_type.inspect}" unless Object.const_defined?(stream_class_name)
|
17
|
+
|
18
|
+
Object.const_get(stream_class_name).new(params)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'media_info/stream'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class AudioStream < Stream
|
5
|
+
TYPE = :audio
|
6
|
+
|
7
|
+
attr_reader :duration,
|
8
|
+
:duration_string,
|
9
|
+
:duration_string1,
|
10
|
+
:duration_string2,
|
11
|
+
:duration_string3,
|
12
|
+
:duration_string4,
|
13
|
+
:duration_string5,
|
14
|
+
:bit_rate,
|
15
|
+
:bit_rate_string,
|
16
|
+
:bit_rate_mode,
|
17
|
+
:bit_rate_mode_string,
|
18
|
+
:bit_rate_minimum,
|
19
|
+
:bit_rate_minimum_string,
|
20
|
+
:bit_rate_nominal,
|
21
|
+
:bit_rate_nominal_string,
|
22
|
+
:bit_rate_maximum,
|
23
|
+
:bit_rate_maximum_string,
|
24
|
+
:channel_s,
|
25
|
+
:channel_s_string,
|
26
|
+
:channel_positions,
|
27
|
+
:channel_positions_string2,
|
28
|
+
:channel_layout,
|
29
|
+
:channel_layout_id,
|
30
|
+
:resolution,
|
31
|
+
:resolution_string,
|
32
|
+
:sampling_rate,
|
33
|
+
:sampling_rate_string,
|
34
|
+
:frame_count,
|
35
|
+
:compression_mode,
|
36
|
+
:compression_mode_string,
|
37
|
+
:encoded_date,
|
38
|
+
:tagged_date
|
39
|
+
|
40
|
+
alias channels channel_s
|
41
|
+
alias channels_string channel_s_string
|
42
|
+
|
43
|
+
def duration_seconds
|
44
|
+
duration / 1000.0
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def duration=(value)
|
50
|
+
@duration = value.to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
def bit_rate=(value)
|
54
|
+
@bit_rate = value.to_i
|
55
|
+
end
|
56
|
+
|
57
|
+
def bit_rate_minimum=(value)
|
58
|
+
@bit_rate_minimum = value.to_i
|
59
|
+
end
|
60
|
+
|
61
|
+
def bit_rate_nominal=(value)
|
62
|
+
@bit_rate_nominal = value.to_i
|
63
|
+
end
|
64
|
+
|
65
|
+
def bit_rate_maximum=(value)
|
66
|
+
@bit_rate_maximum = value.to_i
|
67
|
+
end
|
68
|
+
|
69
|
+
def channel_s=(value)
|
70
|
+
@channel_s = value.to_i
|
71
|
+
end
|
72
|
+
|
73
|
+
def resolution=(value)
|
74
|
+
@resolution = value.to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
def sampling_rate=(value)
|
78
|
+
@sampling_rate = value.to_i
|
79
|
+
end
|
80
|
+
|
81
|
+
def frame_count=(value)
|
82
|
+
@frame_count = value.to_i
|
83
|
+
end
|
84
|
+
|
85
|
+
def encoded_date=(value)
|
86
|
+
@encoded_date = Time.parse(value)
|
87
|
+
end
|
88
|
+
|
89
|
+
def tagged_date=(value)
|
90
|
+
@encoded_date = Time.parse(value)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'media_info/stream'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class GeneralStream < Stream
|
5
|
+
TYPE = :general
|
6
|
+
|
7
|
+
attr_reader :file_size,
|
8
|
+
:file_size_string,
|
9
|
+
:file_size_string1,
|
10
|
+
:file_size_string2,
|
11
|
+
:file_size_string3,
|
12
|
+
:file_size_string4,
|
13
|
+
:file_created_date,
|
14
|
+
:file_created_date_local,
|
15
|
+
:file_modified_date,
|
16
|
+
:file_modified_date_local,
|
17
|
+
:file_name,
|
18
|
+
:file_extension,
|
19
|
+
:complete_name,
|
20
|
+
:complete_name_last,
|
21
|
+
:file_name_last,
|
22
|
+
:file_extension_last,
|
23
|
+
:folder_name,
|
24
|
+
:folder_name_last,
|
25
|
+
:header_size,
|
26
|
+
:data_size,
|
27
|
+
:footer_size,
|
28
|
+
:is_streamable
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def file_size=(value)
|
33
|
+
@file_size = value.to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def file_created_date=(value)
|
37
|
+
@file_modified = Time.parse(value)
|
38
|
+
end
|
39
|
+
|
40
|
+
def file_modified_date=(value)
|
41
|
+
@file_modified = Time.parse(value)
|
42
|
+
end
|
43
|
+
|
44
|
+
def header_size=(value)
|
45
|
+
@header_size = value.to_i
|
46
|
+
end
|
47
|
+
|
48
|
+
def data_size=(value)
|
49
|
+
@data_size = value.to_i
|
50
|
+
end
|
51
|
+
|
52
|
+
def footer_size=(value)
|
53
|
+
@footer_size = value.to_i
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'media_info/stream'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class ImageStream < Stream
|
5
|
+
TYPE = :image
|
6
|
+
|
7
|
+
attr_reader :width,
|
8
|
+
:width_string,
|
9
|
+
:height,
|
10
|
+
:height_string,
|
11
|
+
:color_space,
|
12
|
+
:chroma_subsampling,
|
13
|
+
:bit_depth,
|
14
|
+
:bit_depth_string,
|
15
|
+
:resolution,
|
16
|
+
:resolution_string,
|
17
|
+
:compression_mode,
|
18
|
+
:compression_mode_string
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def width=(value)
|
23
|
+
@width = value.to_i
|
24
|
+
end
|
25
|
+
|
26
|
+
def height=(value)
|
27
|
+
@height = value.to_i
|
28
|
+
end
|
29
|
+
|
30
|
+
def bit_depth=(value)
|
31
|
+
@bit_depth = value.to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def resolution=(value)
|
35
|
+
@resolution = value.to_i
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'media_info/stream'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class MenuStream < Stream
|
5
|
+
TYPE = :menu
|
6
|
+
|
7
|
+
attr_reader :menu_id,
|
8
|
+
:menu_id_string,
|
9
|
+
:duration,
|
10
|
+
:duration_string,
|
11
|
+
:duration_string1,
|
12
|
+
:duration_string2,
|
13
|
+
:duration_string3,
|
14
|
+
:duration_string4,
|
15
|
+
:duration_string5,
|
16
|
+
:duration_start,
|
17
|
+
:duration_end,
|
18
|
+
:delay,
|
19
|
+
:delay_string,
|
20
|
+
:delay_string1,
|
21
|
+
:delay_string2,
|
22
|
+
:delay_string3,
|
23
|
+
:delay_string4,
|
24
|
+
:delay_string5,
|
25
|
+
:delay_settings,
|
26
|
+
:delay_drop_frame,
|
27
|
+
:language,
|
28
|
+
:language_string,
|
29
|
+
:language_string1,
|
30
|
+
:language_string2,
|
31
|
+
:language_string3,
|
32
|
+
:language_string4,
|
33
|
+
:language_more
|
34
|
+
|
35
|
+
def duration_seconds
|
36
|
+
duration / 1000.0
|
37
|
+
end
|
38
|
+
|
39
|
+
def delay_seconds
|
40
|
+
delay / 1000.0
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def menu_id=(value)
|
46
|
+
@menu_id = value.to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
def duration=(value)
|
50
|
+
@duration = value.to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
def delay=(value)
|
54
|
+
@delay = value.to_i
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'media_info/stream'
|
2
|
+
|
3
|
+
module MediaInfo
|
4
|
+
class VideoStream < Stream
|
5
|
+
TYPE = :video
|
6
|
+
|
7
|
+
attr_reader :duration,
|
8
|
+
:duration_string,
|
9
|
+
:duration_string1,
|
10
|
+
:duration_string2,
|
11
|
+
:duration_string3,
|
12
|
+
:duration_string4,
|
13
|
+
:duration_string5,
|
14
|
+
:bit_rate,
|
15
|
+
:bit_rate_string,
|
16
|
+
:bit_rate_mode,
|
17
|
+
:bit_rate_mode_string,
|
18
|
+
:bit_rate_minimum,
|
19
|
+
:bit_rate_minimum_string,
|
20
|
+
:bit_rate_nominal,
|
21
|
+
:bit_rate_nominal_string,
|
22
|
+
:bit_rate_maximum,
|
23
|
+
:bit_rate_maximum_string,
|
24
|
+
:bit_rate_encoded,
|
25
|
+
:bit_rate_encoded_string,
|
26
|
+
:width,
|
27
|
+
:width_string,
|
28
|
+
:height,
|
29
|
+
:height_string,
|
30
|
+
:pixel_aspect_ratio,
|
31
|
+
:pixel_aspect_ratio_string,
|
32
|
+
:resolution,
|
33
|
+
:resolution_string,
|
34
|
+
:display_aspect_ratio,
|
35
|
+
:display_aspect_ratio_string,
|
36
|
+
:rotation,
|
37
|
+
:rotation_string,
|
38
|
+
:frame_rate_mode,
|
39
|
+
:frame_rate_mode_string,
|
40
|
+
:frame_rate,
|
41
|
+
:frame_rate_string,
|
42
|
+
:frame_rate_minimum,
|
43
|
+
:frame_rate_minimum_string,
|
44
|
+
:frame_rate_nominal,
|
45
|
+
:frame_rate_nominal_string,
|
46
|
+
:frame_rate_maximum,
|
47
|
+
:frame_rate_maximum_string,
|
48
|
+
:frame_count,
|
49
|
+
:standard,
|
50
|
+
:color_space,
|
51
|
+
:colorimetry,
|
52
|
+
:chroma_subsampling,
|
53
|
+
:bit_depth,
|
54
|
+
:bit_depth_string,
|
55
|
+
:scan_type,
|
56
|
+
:scan_type_string,
|
57
|
+
:scan_order,
|
58
|
+
:scan_order_string,
|
59
|
+
:compression_mode,
|
60
|
+
:compression_mode_string,
|
61
|
+
:compression_ratio,
|
62
|
+
:bits_pixel_frame, # "Bits-(Pixel*Frame)"
|
63
|
+
:format_settings_bvop,
|
64
|
+
:format_settings_bvop_string,
|
65
|
+
:format_settings_qpel,
|
66
|
+
:format_settings_qpel_string,
|
67
|
+
:format_settings_gmc,
|
68
|
+
:format_settings_gmc_string,
|
69
|
+
:format_settings_matrix,
|
70
|
+
:format_settings_matrix_string,
|
71
|
+
:format_settings_cabac,
|
72
|
+
:format_settings_cabac_string,
|
73
|
+
:format_settings_ref_frames,
|
74
|
+
:format_settings_ref_frames_string,
|
75
|
+
:format_settings_pulldown,
|
76
|
+
:format_settings_pulldown_string,
|
77
|
+
:format_settings_frame_mode,
|
78
|
+
:format_settings_frame_mode_string,
|
79
|
+
:format_settings_gop,
|
80
|
+
:format_settings_gop_string,
|
81
|
+
:format_settings_wrapping,
|
82
|
+
:language,
|
83
|
+
:language_string,
|
84
|
+
:language_string1,
|
85
|
+
:language_string2,
|
86
|
+
:language_string3,
|
87
|
+
:language_string4,
|
88
|
+
:language_more,
|
89
|
+
:encoded_date,
|
90
|
+
:tagged_date
|
91
|
+
|
92
|
+
def duration_seconds
|
93
|
+
duration / 1000.0
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def duration=(value)
|
99
|
+
@duration = value.to_i
|
100
|
+
end
|
101
|
+
|
102
|
+
def bit_rate=(value)
|
103
|
+
@bit_rate = value.to_i
|
104
|
+
end
|
105
|
+
|
106
|
+
def bit_rate_minimum=(value)
|
107
|
+
@bit_rate_minimum = value.to_i
|
108
|
+
end
|
109
|
+
|
110
|
+
def bit_rate_nominal=(value)
|
111
|
+
@bit_rate_nominal = value.to_i
|
112
|
+
end
|
113
|
+
|
114
|
+
def bit_rate_maximum=(value)
|
115
|
+
@bit_rate_maximum = value.to_i
|
116
|
+
end
|
117
|
+
|
118
|
+
def width=(value)
|
119
|
+
@width = value.to_i
|
120
|
+
end
|
121
|
+
|
122
|
+
def height=(value)
|
123
|
+
@height = value.to_i
|
124
|
+
end
|
125
|
+
|
126
|
+
def frame_rate=(value)
|
127
|
+
@frame_rate = value.to_i
|
128
|
+
end
|
129
|
+
|
130
|
+
def frame_rate_minimum=(value)
|
131
|
+
@frame_rate_minimum = value.to_i
|
132
|
+
end
|
133
|
+
|
134
|
+
def frame_rate_nominal=(value)
|
135
|
+
@frame_rate_nominal = value.to_i
|
136
|
+
end
|
137
|
+
|
138
|
+
def frame_rate_maximum=(value)
|
139
|
+
@frame_rate_maximum = value.to_i
|
140
|
+
end
|
141
|
+
|
142
|
+
def bit_depth=(value)
|
143
|
+
@bit_depth = value.to_i
|
144
|
+
end
|
145
|
+
|
146
|
+
def resolution=(value)
|
147
|
+
@resolution = value.to_i
|
148
|
+
end
|
149
|
+
|
150
|
+
def encoded_date=(value)
|
151
|
+
@encoded_date = Time.parse(value)
|
152
|
+
end
|
153
|
+
|
154
|
+
def tagged_date=(value)
|
155
|
+
@encoded_date = Time.parse(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: media_info
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Radovan Smitala
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: reek
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- lib/media_info.rb
|
104
|
+
- lib/media_info/parser.rb
|
105
|
+
- lib/media_info/stream.rb
|
106
|
+
- lib/media_info/stream_factory.rb
|
107
|
+
- lib/media_info/streams/audio.rb
|
108
|
+
- lib/media_info/streams/general.rb
|
109
|
+
- lib/media_info/streams/image.rb
|
110
|
+
- lib/media_info/streams/menu.rb
|
111
|
+
- lib/media_info/streams/other.rb
|
112
|
+
- lib/media_info/streams/text.rb
|
113
|
+
- lib/media_info/streams/video.rb
|
114
|
+
- lib/media_info/version.rb
|
115
|
+
homepage: http://github.com/radeno/ruby-mediainfo-simple
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '2.0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements:
|
134
|
+
- mediainfo
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.6.11
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: A simple meta information about files with MediaInfo.
|
140
|
+
test_files: []
|