Skip to content

Commit 6d54abb

Browse files
committed
ffmpeg: fix get_fps()
1 parent 595fd27 commit 6d54abb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/videoio/src/cap_ffmpeg_impl.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,14 @@ int CvCapture_FFMPEG::get_bitrate() const
11351135

11361136
double CvCapture_FFMPEG::get_fps() const
11371137
{
1138+
#if 0 && LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 1, 100) && LIBAVFORMAT_VERSION_MICRO >= 100
1139+
double fps = r2d(av_guess_frame_rate(ic, ic->streams[video_stream], NULL));
1140+
#else
1141+
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
1142+
double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
1143+
#else
11381144
double fps = r2d(ic->streams[video_stream]->r_frame_rate);
1145+
#endif
11391146

11401147
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
11411148
if (fps < eps_zero)
@@ -1148,7 +1155,7 @@ double CvCapture_FFMPEG::get_fps() const
11481155
{
11491156
fps = 1.0 / r2d(ic->streams[video_stream]->codec->time_base);
11501157
}
1151-
1158+
#endif
11521159
return fps;
11531160
}
11541161

0 commit comments

Comments
 (0)