[FFmpeg-user] How to get TBR in FFProbe JSON

Simon Thelen ffmpeg-user at c-14.de
Sat Jun 28 16:41:36 CEST 2014


On 28/06/14 at 09:12, Ramit Bhalla wrote:
> I'm sorry, I meant to say the Actual framerate is given by TBR (not TBC).
> In the above example the standard output shows:
> Stream #0:11[0x581]: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 320x180, 7.50 fps, 5 tbr,
>  90k tbn, 14.99 tbc
> 
> So that shows:
> FPS -> 7.5
> TBR -> 5
> TBC -> 14.99
> 
> When I use the JSON output I see
> "index": 11,
> "codec_name": "h264",
> "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
> "profile": "Constrained Baseline",
> "codec_type": "video",
> "codec_time_base": "1001/15000",
> "codec_tag_string": "[27][0][0][0]",
> "codec_tag": "0x001b",
> "width": 320,
> "height": 180,
> "has_b_frames": 0,
> "sample_aspect_ratio": "0:1",
> "display_aspect_ratio": "0:1",
> "pix_fmt": "yuv420p",
> "level": 12,
> "id": "0x581",
> "r_frame_rate": "5000/1001",
> "avg_frame_rate": "15/2",
> "time_base": "1/90000",
> "start_pts": 7298654101,
> "start_time": "81096.156678",
> "duration_ts": 2462460,
> "duration": "27.360667",
> 
> This shows:
> r_frame_rate -> 4.99
> avg_frame_rate -> 7.5
> 
> The correct frame rate for this video is 5. So I'm lost now how do get this
> number 5 from the JSON output?
> 
> i.e. The standard version of the output gives TBR but how do I get the TBR
> in JSON?
After a little bit of digging through the FFmpeg source code, I can
verify that the r_frame_rate is the same thing as the tbr, the only
reason that ffprobe with default output gives it as 5 is because it uses
the %3.2f format string which will round 4.995 to 5. 4.995 being the
result of 5000/1001.

-- 
Simon Thelen
purpitation, n.:
	To take something off the grocery shelf, decide you
	don't want it, and then put it in another section.
		-- "Sniglets", Rich Hall & Friends


More information about the ffmpeg-user mailing list