[FFmpeg-user] h264_v4l2m2m encoder separate header mode usage

JooAun Saw jasaw81 at gmail.com
Mon Aug 19 05:43:53 EEST 2019

Hi all,

I'm trying to use the h264_v4l2m2m encoder. By following the
"doc/examples/encode_video.c" example, I managed to send NV21 format
images to it, and receive encoded packets from it. All good until

The encoder sends out the stream header as a separate packet because
"ffmpeg/libavcodec/v4l2_m2m_enc.c" hardcoded the header mode to
HEADER_MODE_SEPARATE. I currently use av_write_frame function to write
the received packet to my mp4 file, but ffprobe & other players
complain of missing keyframe at timestamp 0. I think media players
expect the first frame to be a keyframe.

Question is, what is the correct way to write this header packet to my
output mp4 file?


More information about the ffmpeg-user mailing list