4

I'm using hardware encoding via FFMPEG and h264_v4l2m2m codec.

If I'm using FFmpeg h264_v4l2m2m, the encoded video looks like this

ffmpeg -i small.mp4 -vcodec h264_v4l2m2m grb_2-v4l2.avi

[h264_v4l2m2m @ 0x13d24d0] driver 'bcm2835-codec' on card 'bcm2835-codec-isp'
[h264_v4l2m2m @ 0x13d24d0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode'
[h264_v4l2m2m @ 0x13d24d0] Using device /dev/video11
[h264_v4l2m2m @ 0x13d24d0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode'
[h264_v4l2m2m @ 0x13d24d0] Failed to set number of B-frames
    Last message repeated 1 times
[h264_v4l2m2m @ 0x13d24d0] Failed to set header mode
[h264_v4l2m2m @ 0x13d24d0] Failed to set gop size
[h264_v4l2m2m @ 0x13d24d0] h264 profile not found
[h264_v4l2m2m @ 0x13d24d0] Encoder adjusted: qmin (0), qmax (51)
[h264_v4l2m2m @ 0x13d24d0] Failed to set minimum video quantizer scale
[h264_v4l2m2m @ 0x13d24d0] Failed to set maximum video quantizer scale

And while processing:

[avi @ 0x145aa20] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing 
to 1. This may result in incorrect timestamps in the output file.

If the video container is not AVI, then the resulting video is blank.

I want to use this encoder as a backend codec for OpenCV. If I'm trying to use it, I'm getting the following error:

This encoder requires using the avcodec_send_frame() API

What is the workaround and where should I look?

  • Machine: Raspberry Pi 4B+
  • System: Custom Yocto Distribution (master branches)
  • OpenCV version: 4.1.0
  • FFMpeg version: 4.2.2

0 Answers0