[FFmpeg-devel] [PATCH v2] avcodec/v4l2_m2m: fix setting the frame rate

Ming Qian ming.qian at nxp.com
Tue Mar 17 13:29:23 EET 2020


v4l2 set the frame rate through frame intervals,
not set frame rate directly.
the frame rate and frame intervals are reciprocal.
so in libavdevice/v4l2.c we can see the following code:
	tpf->numerator   = framerate_q.den;
	tpf->denominator = framerate_q.num;

Signed-off-by: Ming Qian <ming.qian at nxp.com>
---
 libavcodec/v4l2_m2m_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index c9f1741bfd..84de63ec9d 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -172,7 +172,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
      * settingss
      */
     if (avctx->framerate.num || avctx->framerate.den)
-        v4l2_set_timeperframe(s, avctx->framerate.num, avctx->framerate.den);
+        v4l2_set_timeperframe(s, avctx->framerate.den, avctx->framerate.num);
 
     /* set ext ctrls */
     v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode");
-- 
2.17.1



More information about the ffmpeg-devel mailing list