Commit e5e30253 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #7213 from alalek:issue_7203

parents 4013ce57 03767340
...@@ -1135,7 +1135,14 @@ int CvCapture_FFMPEG::get_bitrate() const ...@@ -1135,7 +1135,14 @@ int CvCapture_FFMPEG::get_bitrate() const
double CvCapture_FFMPEG::get_fps() const double CvCapture_FFMPEG::get_fps() const
{ {
#if 0 && LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(55, 1, 100) && LIBAVFORMAT_VERSION_MICRO >= 100
double fps = r2d(av_guess_frame_rate(ic, ic->streams[video_stream], NULL));
#else
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54, 1, 0)
double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
#else
double fps = r2d(ic->streams[video_stream]->r_frame_rate); double fps = r2d(ic->streams[video_stream]->r_frame_rate);
#endif
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
if (fps < eps_zero) if (fps < eps_zero)
...@@ -1148,7 +1155,7 @@ double CvCapture_FFMPEG::get_fps() const ...@@ -1148,7 +1155,7 @@ double CvCapture_FFMPEG::get_fps() const
{ {
fps = 1.0 / r2d(ic->streams[video_stream]->codec->time_base); fps = 1.0 / r2d(ic->streams[video_stream]->codec->time_base);
} }
#endif
return fps; return fps;
} }
...@@ -1575,6 +1582,10 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc, ...@@ -1575,6 +1582,10 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatContext *oc,
} }
#endif #endif
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(52, 42, 0)
st->avg_frame_rate = (AVRational){frame_rate, frame_rate_base};
#endif
return st; return st;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment