Every time I try to get some information about my video files with ffmpeg, it pukes a lot of useless information mixed with good things.
I’m using ffmpeg -i name_of_the_video.mpg.
There are any possibilities to get that in a friendly way? I mean JSON would be great (and even ugly XML is fine).
By now, I made my application parse the data with regex but there are lots of nasty corners that appear on some specific video files. I fixed all that I encountered, but there may be more.
I wanted something like:
{
"Stream 0": {
"type": "Video",
"codec": "h264",
"resolution": "720x480"
},
"Stream 1": {
"type": "Audio",
"bitrate": "128 kbps",
"channels": 2
}
}
A bit late, but perhaps still relevant to someone..
ffprobeis indeed an excellent way to go. Note, though, that you need to tellffprobewhat information you want it to display (with the-show_format,-show_packetsand-show_streamsoptions) or it’ll just give you blank output (like you mention in one of your comments).For example,
ffprobe -v quiet -print_format json -show_format -show_streams somefile.asfwould yield something like the following: