2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/media_info_parser.rb', line 2
def self.parse_with_convert_command media_info, filename
video = audio = nil
media_info.split("Track ID").each{ |section|
section =~ /:(\W+)(\d+)/
id = $2
section =~ /Stream ID: (\S+)/ stream_type = $1
if stream_type
raise unless id
if section =~ /Frame rate/ && !video
section =~ /Frame rate: ([\d\.]+)/
fps = $1
raise unless fps
raise unless section =~ /lang: eng/ video = "#{stream_type}, \"#{filename}\", fps=#{fps}, track=#{id}, lang=eng"
elsif section =~ /Channels:/ && !audio
raise unless section =~ /lang: eng/ audio = "#{stream_type}, \"#{filename}\", track=#{id}, lang=eng"
end
end
}
raise unless video && audio
return "MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500\n#{video}\n#{audio}"
end
|