Sha256: 7d04f973390c239453a65839b0009de5d3cd0818daef64367c864628c0c4e483
Contents?: true
Size: 1.06 KB
Versions: 28
Compression:
Stored size: 1.06 KB
Contents
module MediaInfoParser 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+)/ # like V_MPEG-2 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/ # expect... video = "#{stream_type}, \"#{filename}\", fps=#{fps}, track=#{id}, lang=eng" elsif section =~ /Channels:/ && !audio raise unless section =~ /lang: eng/ # hope english audio track comes first... # A_AC3, "G:\Video\Sintel_NTSC\title01.mkv", track=2, 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 end
Version data entries
28 entries across 28 versions & 2 rubygems