On Tue, 15 Dec 2020 at 02:54, Ram Shaffir <[email protected]> wrote:

>
> > The problem now is that only the first part file '1-output.ts' is
> playable, the
> > other parts, '2-output.ts' and onwards, are not playable when using
> ffplay:
>
>
> I've told that to fix the problem I'm facing with the V4L2 H264 encoder
> (repeat headers), I should enable V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER in
> the call v4l2_set_ext_ctrl (
> https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/v4l2_m2m_enc.c#L53)
>
>
> Does it mean that I need to add it like this and recompile?:
>
> static inline int v4l2_get_ext_ctrl(V4L2m2mContext *s, unsigned int id,
> signed int *value, const char *name, int log_warning)
> {
>     struct v4l2_ext_controls ctrls = { { 0 } };
>     struct v4l2_ext_control ctrl = { 0 };
>     int ret;
>
>     /* like this? */
>     V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER = 1;
>
>     /* set ctrls */
>     ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
>     ctrls.controls = &ctrl;
>     ctrls.count = 1;
>
>     /* set ctrl*/
>     ctrl.id = id ;
>
>     ret = ioctl(s->fd, VIDIOC_G_EXT_CTRLS, &ctrls);
>     if (ret < 0) {
>         av_log(s->avctx, log_warning || errno != EINVAL ? AV_LOG_WARNING :
> AV_LOG_DEBUG,
>                "Failed to get %s\n", name);
>         return ret;
>     }
>
>     *value = ctrl.value;
>
>     return 0;
> }


You should be able to set the option with the attached patch.
Haven't had time to test though.

--
 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
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to