Get ffmpeg friendly information

Every time I try to get some information about my video files using ffmpeg, it causes a lot of useless information mixed with good things.

I am using ffmpeg -i name_of_the_video.mpg .

Are there any ways to get this in a friendly way? I mean, JSON will be great (and even ugly XML is fine).

Currently, I have made my application parsing regexp data, but there are a lot of nasty angles that appear on some specific video files. I fixed everything that I encountered, but maybe more.

I wanted something like:

 { "Stream 0": { "type": "Video", "codec": "h264", "resolution": "720x480" }, "Stream 1": { "type": "Audio", "bitrate": "128 kbps", "channels": 2 } } 
+85
json parsing ffmpeg
Oct 10 '11 at 3:50
source share
2 answers

A bit late, but maybe still relevant to someone ..

ffprobe really a great way. Note, however, that you need to tell ffprobe what information you want to display (with the -show_format , -show_packets and -show_streams ), or just give you an empty output (as you mention in one of your comments).

For example, ffprobe -v quiet -print_format json -show_format -show_streams somefile.asf will result in the following:

 { "streams": [{ "index": 0, "codec_name": "wmv3", "codec_long_name": "Windows Media Video 9", "codec_type": "video", "codec_time_base": "1/1000", "codec_tag_string": "WMV3", "codec_tag": "0x33564d57", "width": 320, "height": 240, "has_b_frames": 0, "pix_fmt": "yuv420p", "level": -99, "r_frame_rate": "30000/1001", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_time": "0.000", "duration": "300.066", "tags": { "language": "eng" } }], "format": { "filename": "somefile.asf", "nb_streams": 1, "format_name": "asf", "format_long_name": "ASF format", "start_time": "0.000", "duration": "300.066", "tags": { "WMFSDKVersion": "10.00.00.3646", "WMFSDKNeeded": "0.0.0.0000", "IsVBR": "0" } } } 
+237
Nov 19 2018-11-11T00:
source share

You can try ffprobe . The correct command for JSON output should look like this:

 ffprobe ... -print_format json 
+11
10 Oct 2018-11-11T00:
source share



All Articles