[Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264

Ashwin Chandra - SISA ashwin.c at sisa.samsung.com
Fri Feb 8 00:08:05 CET 2013

I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264.

The sequence I follow is

1.  Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame.

2.  Call avcodec_encode_video2 again passing NULL in the AVFrame parameter.

3.  Repeat 2. Until a frame arrives from the encoder.

This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130207/f11e642c/attachment.html>

More information about the Libav-user mailing list