[Libav-user] Keeping all frames in mp4 with h264 codec

Arthur Muller muller at vki.com
Wed Feb 10 18:24:06 CET 2016

First of all, thanks to Max and Salsaman for the responses. I truly appreciate it.

>As long as I remember I solved a similar problem after providing the last frame of the sequence by calling avcodec_encode_video2  with frame parameter being NULL in a loop while got_packet returns true. 


I am passing a NULL frame after calling calling avcodec_encode_video2  for all my 36 frames. But I only pass the NULL frame once, when I’m done, to make sure everything that has not been flushed is actually flushed.

>Also, just a guess but 18 is half of 36. Is it possible you need to set some interlacing option ?


I have to admit my knowledge of this is very limited. But this is what I know:

1) I am sending down 36 non-trivial frames, plus one NULL frame, for a total of 37 frames.

2) After sending down the first 18 frames by calling avcodec_encode_video2 the value of got_packet is 0 for all of them.

3) When sending frames 19-36, the value of got_packet is 1.

4) When displaying my video, the only images I see are the first 18. I know this for a fact because the images are very similar, but each has a label with a time stamp 0, 10, 20, etc. So I know which ones are missing. Interestingly enough, the missing ones are the ones for which got_packet=1 (!).

If the issue is “interlacing”, can somebody suggest what I need to do in my code to try to correct this?



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

More information about the Libav-user mailing list