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

Andriy Gelman andriy.gelman at gmail.com
Wed Dec 16 07:56:19 EET 2020


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_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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20201216/8a1cf78f/attachment.bin>


More information about the ffmpeg-user mailing list