How to get h264 video info?

Zelenov picture Zelenov · Jan 21, 2012 · Viewed 47.9k times · Source

How can I get specific h264 video information from video file? I need to know profile (Baseline/Main/High) and is there B-Frames in movie?

Answer

Zelenov picture Zelenov · Dec 31, 2012

I've found out that the best way for this is using FFprobe with -show_streams parameter. It shows both h.264 profile and B-frames usage for video streams of the movie.

ffprobe -show_streams -i "file.mp4"

[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/48000
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
has_b_frames=0
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=yuv420p
level=40
timecode=N/A
is_avc=1
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/48000
start_time=0.000000
duration=252.168583
bit_rate=5617233
nb_frames=6046
nb_read_frames=N/A
nb_read_packets=N/A
TAG:creation_time=1970-01-01 00:00:00
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]