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

Version Path
content-editing-movie-player-0.38.0 lib/media_info_parser.rb
sensible-cinema-0.35.3 lib/media_info_parser.rb
sensible-cinema-0.34.0 lib/media_info_parser.rb
sensible-cinema-0.28.1 lib/media_info_parser.rb
sensible-cinema-0.28.0 lib/media_info_parser.rb
sensible-cinema-0.27.0 lib/media_info_parser.rb
sensible-cinema-0.26.3 lib/media_info_parser.rb
sensible-cinema-0.26.2 lib/media_info_parser.rb
sensible-cinema-0.26.1 lib/media_info_parser.rb
sensible-cinema-0.26.0 lib/media_info_parser.rb
sensible-cinema-0.25.4 lib/media_info_parser.rb
sensible-cinema-0.25.3 lib/media_info_parser.rb
sensible-cinema-0.25.2 lib/media_info_parser.rb
sensible-cinema-0.25.1 lib/media_info_parser.rb
sensible-cinema-0.25.0 lib/media_info_parser.rb
sensible-cinema-0.24.9 lib/media_info_parser.rb
sensible-cinema-0.24.8 lib/media_info_parser.rb
sensible-cinema-0.24.7 lib/media_info_parser.rb
sensible-cinema-0.24.6 lib/media_info_parser.rb
sensible-cinema-0.24.5 lib/media_info_parser.rb