I would like to find out the exact format/container of a video file using ffprobe but I am unable to reach to the "exact" part of it.
When I run this sample command:
ffprobe -hide_banner -loglevel fatal -show_error -show_format -print_format json INPUT
I receive this output:
{
"format": {
"filename": "INPUT",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "matroska,webm",
"format_long_name": "Matroska / WebM",
"start_time": "0.000000",
"duration": "2.969000",
"size": "2376430",
"bit_rate": "6403314",
"probe_score": 100,
"tags": {
"COM.ANDROID.VERSION": "9",
"MAJOR_BRAND": "mp42",
"MINOR_VERSION": "0",
"COMPATIBLE_BRANDS": "isommp42",
"COM.ANDROID.CAPTURE.FPS": "30.000000",
"ENCODER": "Lavf57.83.100"
}
}
}
As you may have understood, ffprobe gives a list of formats inside the format_name
value. This is true for several video formats like mp4, mkv, webm, etc.
Whereas, mediainfo
is able to find out the exact type of format, i.e. it outputs a single Format
like below:
Command: mediainfo INPUT
Output:
General
Unique ID : 41836023869371892704046005573890259380 (0x1F79533A912A2117C3D4CEB704EAB9B4)
Complete name : intermediate.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 2.27 MiB
Duration : 2 s 969 ms
Overall bit rate mode : Variable
Overall bit rate : 6 403 kb/s
Writing application : Lavf57.83.100
Writing library : Lavf57.83.100
ErrorDetectionType : Per level 1
COM.ANDROID.CAPTURE.FPS : 30.000000
COM.ANDROID.VERSION : 9
*Outputs truncated for decluttering info
Can anyone guide me as to how to achieve this using ffprobe itself?
mediainfo
and any mime_type inferrer likepython-magic
is able to – Capetian