[FFmpeg-devel] [PATCH] examples/decoding_encoding: flush audio frames in the encoder
Stefano Sabatini
stefasab at gmail.com
Wed Aug 22 12:02:37 CEST 2012
On date Wednesday 2012-08-22 01:26:13 +0200, Michael Niedermayer encoded:
> On Tue, Aug 21, 2012 at 10:32:01PM +0200, Stefano Sabatini wrote:
> > ---
> > doc/examples/decoding_encoding.c | 14 ++++++++++++++
> > 1 files changed, 14 insertions(+), 0 deletions(-)
>
> should be ok
Thanks, applied.
BTW, I wonder if this use of the API is correct:
/* encode the samples */
ret = avcodec_encode_audio2(c, &pkt, frame, &got_output);
if (ret < 0) {
fprintf(stderr, "error encoding audio frame\n");
exit(1);
}
if (got_output) {
fwrite(pkt.data, 1, pkt.size, f);
av_free_packet(&pkt);
}
What if we have more than one packet per frame?
Shouldn't we update pkt.data/size until *got_output is 0? This way we
avoid to cache frames in the encoder (especially if the frames
contains a huge amount of samples).
--
FFmpeg = Forgiving Fiendish Maxi Philosofic Erratic Game
More information about the ffmpeg-devel
mailing list