Class: Ffprobe::MediaFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ffprobe.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ MediaFile

Returns a new instance of MediaFile.



7
8
9
10
11
12
13
# File 'lib/ffprobe.rb', line 7

def initialize file_name
  options = "-hide_banner -loglevel panic -print_format json -show_format -show_streams"
  cmd = "ffprobe #{options} #{file_name}"
  stdout = `#{cmd}`
  file_hash = JSON.parse(stdout)
  @file = MyHash.new file_hash
end

Instance Method Details

#formatObject



21
22
23
# File 'lib/ffprobe.rb', line 21

def format
  MyHash.new @file.format
end

#streamsObject



15
16
17
18
19
# File 'lib/ffprobe.rb', line 15

def streams
  @file.streams.map do |stream|
    MyHash.new stream
  end
end