Hi Bernhard,

 

>after real frames are handled did you call avcodec_encode_video2 with NULL as 
>frame as many times as got_packet returns true?

> 

>Depending on codec you have to "flush" encoder several times, until all frames 
>have gone to output.

 

Success!! Thanks!

 

But I do need one clarification: it just so happens that I have 36 frames, half 
return got_packet=0 and half return got_packet=1. So I called 
avcodec_encode_video2 18 times with a NULL frame. So here are my questions:

 

1) You mention I call this function with a NULL frame as many times as 
got_packet returns true (=1). Shouldn’t it be the other way around? That is, I 
should only flush as many times as got_packet returns false (=0)?

 

2) Is there a way to know exactly how many times I should call this function 
with a NULL frame? I can certainly count the number of got_packets={0 or 1}; 
but I’m wondering whether the ffmpeg api wouldn’t have that information itself 
in a way that would be more self-contained.

 

3) Is it safe to call this function with a NULL packet several times – even 
more than necessary to flush everything?

 

4) Finally, is it safe to call this function several times for other codecs – 
even if nothing needs to be flushed? In other words, would ffmpeg treat this 
call as a no-op if it’s not necessary?

 

Thanks again!

 

-Arthur

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to