Skip to content

h264_v4l2m2m not working #1748

Closed
Closed
@frotinybo

Description

Did you read the guide?

Yes

What is the base version number of Motion being used?

4.6.x

What was the install method?

Built from source code

What is base architecture?

ARM-32bit

What is the distro being used?

Other

Disto version number

DietPi Bookworm

Camera type(s) being used?

v4l2 USB camera

Describe the issue/problem and steps to reproduce

Selecting a H.264/V4L2M2M codec in order to get advantage of hardware acceleration fails :
"ffmpeg_set_codec: Could not open codec Invalid argument"

ffmpeg version 5.1.4-0+rpt1+deb12u1 (dietpi distro)

Motion log output at log_level 8

Please patch with the equivalent of the motionplus project "commit ef3b424" in ffmpeg.c :

...
/*
   if (movie->preferred_codec == USER_CODEC_V4L2M2M) {
        movie->ctx_codec->pix_fmt   = AV_PIX_FMT_NV21;
    } else {
        movie->ctx_codec->pix_fmt   = MY_PIX_FMT_YUV420P;
    }
*/
    movie->ctx_codec->pix_fmt   = MY_PIX_FMT_YUV420P;
...
/*
        if (movie->preferred_codec == USER_CODEC_V4L2M2M) {
            movie_put_pix_nv21(movie, img_data);
        } else {
            movie_put_pix_yuv420(movie, img_data);
        }
*/
        movie_put_pix_yuv420(movie, img_data);

It works OK after the patch.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions