lib/video_converter/mp4info.rb
# Get the numeric audio or video bitrate from the MP4 video
# file at path.
#
# @param path [String] Path to an MP4 video file
# @param type [#to_s] :audio or :video
# @return [Float] The audio or video bitrate of the MP4 file
Get the numeric audio or video bitrate from the MP4 video
file at path.
Get the numeric audio or video bitrate from the MP4 video file at path .
def bitrate(path, type)
      formatted = formatted_bitrate(path, type).sub(/bps$/, '')
      case formatted
      when /M$/
        formatted.sub(/M$/, '').strip.to_f * 1_000_000.0
      when /k$/
        formatted.sub(/k$/, '').strip.to_f * 1000.0
      else
        formatted.strip.to_f
      end
    end
def bitrate ( path , type ) formatted = formatted_bitrate ( path , type ) . sub ( / bps$ / , '' ) case formatted when / M$ / formatted . sub ( / M$ / , '' ) . strip . to_f * 1_000_000.0 when / k$ / formatted . sub ( / k$ / , '' ) . strip . to_f * 1000.0 else formatted . strip . to_f end end
Get the numeric audio or video bitrate from the MP4 video
file at path.
Get the numeric audio or video bitrate from the MP4 video file at path .
The audio or video bitrate of the MP4 file
The audio or video bitrate of the MP4 file
Float
path
Path to an MP4 video file
Path to an MP4 video file
type
:audio or :video
: audio or : video