Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Speed up ffmpeg format probing if we'll trust codec fps for playback #2378

wants to merge 2 commits into


None yet
3 participants

juanfont commented Mar 6, 2013

This small change allows you to (re)use the pre-exiting advancedsettings.xml 'fpsdetect' option in order to reduce the playback starting time.

Until now, 'fpsdetect' was only used in the video players, with values:

0 = trust codec fps
1 = recalculate from video timestamps with uniform spacing
2 = recalculate from video timestamps always

With this patch AVFormatContext field 'fps_probe_size' will be 0 when we trust codec fps, avoiding spend up to 40 frames¹ per video stream recalculating the framerate.

¹: https://github.com/xbmc/xbmc/blob/master/lib/ffmpeg/libavformat/utils.c#L2606

@arnova arnova and 1 other commented on an outdated diff Mar 6, 2013

@@ -425,6 +425,9 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput)
// set the interrupt callback, appeared in libavformat 53.15.0
m_pFormatContext->interrupt_callback = int_cb;
+ // Avoid detecting framerate if advancedsettings.xml says so
+ m_pFormatContext->fps_probe_size = (!g_advancedSettings.m_videoFpsDetect) ? 0 : -1;

arnova Mar 6, 2013


Would be a bit clearer if written as ... (g_advancedSettings.m_videoFpsDetect == 0) ? ...


juanfont Mar 6, 2013


@arnova I had "if [not detecting_framerate] ? 0 : -1" on my mind, but I guess you are right. I'll change it.

@juanfont juanfont closed this Mar 6, 2013

@juanfont juanfont deleted the unknown repository branch Mar 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment