[FFmpeg-user] h264_v4l2m2m Failed to set gop size: Invalid argument

Ram Shaffir ram at ram.sh
Wed Dec 16 12:18:26 EET 2020


Success!! 
I've applied your patch, and it works. You're a lifesaver!!
Thank you so very much,
RS.

> -----Original Message-----
> From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Andriy
> Gelman
> Sent: Wednesday, December 16, 2020 7:56 AM
> To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
> Subject: Re: [FFmpeg-user] h264_v4l2m2m Failed to set gop size: Invalid
> argument
> 
> On Tue, 15 Dec 2020 at 02:54, Ram Shaffir <ram at ram.sh> 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_en
> c.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


More information about the ffmpeg-user mailing list