On Sun, 15 Aug 2021 at 10:15, Adam Nielsen <a.niel...@shikadi.net> wrote:

> > > I'm using the h264_v4l2m2m codec to do hardware accelerated encoding on
> > > a Raspberry Pi.  This is working well, except I am unable to set any
> > > encoder options such as bitrate, as I cannot find how to tell ffmpeg to
> > > set V4L2 control options.
> >
> > You can use -b:v option to set the bitrate, i.e.
> > ./ffmpeg -i input -codec:v h264_v4l2m2m -b:v 2M out.mp4
> >
> > There is a patch for documentation that I need to update. It may be
> useful
> > to you:
> >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200117034211.12142-1-andriy.gel...@gmail.com/
>
> Ah excellent, many thanks for that, that does work for setting the
> bitrate.
>
> Unfortunately the most important option I need to change is the
> "repeat_sequence_header" control, which I need to set to 1 as the
> default of 0 means if you miss the initial frame of the video, you can
> never join the stream mid-way through, as ffplay just produces heaps of
> "non-existing PPS 0 referenced" messages and never opens the video
> window.
>
>

> Does this option have an equivalent to set on the ffmpeg command line,
> now v4l2-ctl will no longer work?


Not yet.
Can you test the attached patch, please? It will init the
repeat_sequence_header option to 1.

Thanks,
Andriy
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
index f644b50133..4b2ca7bdf4 100644
--- a/libavcodec/v4l2_m2m_enc.c
+++ b/libavcodec/v4l2_m2m_enc.c
@@ -197,6 +197,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s)
     v4l2_set_ext_ctrl(s, MPEG_CID(BITRATE) , avctx->bit_rate, "bit rate", 1);
     v4l2_set_ext_ctrl(s, MPEG_CID(FRAME_RC_ENABLE), 1, "frame level rate control", 0);
     v4l2_set_ext_ctrl(s, MPEG_CID(GOP_SIZE), avctx->gop_size,"gop size", 1);
+    v4l2_set_ext_ctrl(s, MPEG_CID(REPEAT_SEQ_HEADER), 1,"repeat parameter sets", 1);
 
     av_log(avctx, AV_LOG_DEBUG,
         "Encoder Context: id (%d), profile (%d), frame rate(%d/%d), number b-frames (%d), "
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to