2

I'm currently writing a regular expression for deciphering the output from FFmpeg, after using FFmpeg to determine the attributes from a file with the following command;

ffmpeg.exe -i .\test.avi

The output would be along the lines of this;

FFmpeg version SVN-r26400, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 18 2011 04:07:05 with gcc 4.4.2

Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 15.00 (15/1) Input #0, avi, from 'test.avi':
Duration: 00:27:46.60, start: 0.000000, bitrate: 154 kb/s Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 15 fps, 15 tbr, 15 tbn, 30k tbc Stream #0.1: Audio: mp3, 24000 Hz, 2 channels, s16, 40 kb/s At least one output file must be specified

Now what I'm looking for guide for the all the abbreviations and possible names so that my regular expression won't potentially break. For example, mpeg4, mp3, 2 channel, mono, a list of formats supported and their names. I've looked through the FFmpeg documentation but can't find exactly what I want

Thanks for any help!

2
  • 1
    Maybe it is better to write dedicated program for metainfo retrieving using ffmpeg's library (libavcodec) instead of parsing the output of ffmpeg utility?
    – ulidtko
    Commented Jan 19, 2011 at 14:16
  • 1
    Also, you may find all possible abbreviations and output variations in the source of ffmpeg utility.
    – ulidtko
    Commented Jan 19, 2011 at 14:17

1 Answer 1

6

There's a tool that comes with ffmpeg that is far better suited to what you are trying to do: ffprobe. Using the -show_streams option, it is much more amenable to regex (one key=value pair per line by default, and it outputs to stdout). To show information about all the streams:

ffprobe -i input.file -show_streams

You can also view information about specific streams with -select_streams.

##  shows information about all video streams:
ffprobe -i input.file -show_streams -select_streams v
##  shows information about the first audio stream:
ffprobe -i input.file -show_streams -select_streams a:0

To view information about the container format, use -show_format

Check out the documentation for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .