Reputation: 2230
I'm trying to find a certain way to understand if a given file is using the h.264 codec and it's streamable.
I'm using ffprobe and sometimes I get output such as this:
{
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2036-02-06 06:28:16
encoder : HandBrake 0.10.2 2015060900
Duration: 00:06:42.13, start: 0.000000, bitrate: 950 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x480 [SAR 1:1 DAR 4:3], 788 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2036-02-06 06:28:16
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default)
Metadata:
creation_time : 2036-02-06 06:28:16
handler_name : Stereo
"format": {
"filename": "file.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "402.134000",
"size": "47787790",
"bit_rate": "950683",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "512",
"compatible_brands": "isomiso2avc1mp41",
"creation_time": "2036-02-06 06:28:16",
"encoder": "HandBrake 0.10.2 2015060900"
}
}
}
now, it seems that the file is streamable and it's ok to be put online, but I was expecting something like this:
"format_name": "h.264",
instead I get
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
which seems very lax in terms of specifying what the hell this file is. I'm also using MP4Box in order to see if the video is streamable, but at this point I'm not sure how to handle specific h.264 recognition.
what should I do in order to be sure that a given file has the h.264 codec?
thanks
Upvotes: 2
Views: 9377
Reputation: 2230
turns out it was my error :)
this is the correct command
/opt/ffmpeg/ffprobe file.mp4 -show_streams -select_streams v -print_format json
which in turn gives:
{
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Main",
"codec_type": "video",
"codec_time_base": "1/180000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 640,
"height": 480,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "4:3",
"pix_fmt": "yuv420p",
"level": 40,
"color_range": "tv",
"color_space": "smpte170m",
"color_transfer": "bt709",
"color_primaries": "smpte170m",
"chroma_location": "left",
"refs": 4,
"is_avc": "1",
"nal_length_size": "4",
"r_frame_rate": "30/1",
"avg_frame_rate": "90465/3016",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 36192000,
"duration": "402.133333",
"bit_rate": "788651",
"bits_per_raw_sample": "8",
"nb_frames": "12062",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"creation_time": "2036-02-06 06:28:16",
"language": "und",
"handler_name": "VideoHandler"
}
}
]
}
Upvotes: 3