[Libav-user] FFMpeg and callbacks
Denis
info at denisgottardello.it
Mon Jan 30 22:47:36 CET 2012
For my application is essential use the callbacks. I have understood how to
use callback on decoding but not on encoding.
If is right, on order to obtain an encoded file from a sequence of images the
steps are:
1) initialize AVOutputFormat
2) initialize AVFormatContext and referred it to AVOutputFormat
3) use avio_open for open the output file
4) initialize AVStream
5) initialize AVCodec
6) using avcodec_encode_video, AVPacket and av_interleaved_write_frame is
possible to store the inage into the output file.
That works. I can produce webm, mp4 and mpg file. But now the goal is to modify
the sequence in order to use callback on write event.
I have modified the sequence like this
0) AVIOContext= avio_alloc_context(pBuffer, BUFFERSIZE, 0, this, NULL,
WritePacket, NULL);
1) initialize AVOutputFormat
2) initialize AVFormatContext and referred it to AVOutputFormat and
AVIOContext
"pAVFormatContext->oformat= pAVOutputFormat;"
"pAVFormatContext->pb= pAVIOContext;"
3) remove avio_open for open the output file
4) initialize AVStream
5) initialize AVCodec
6) using avcodec_encode_video, AVPacket and av_interleaved_write_frame.
but does not work with all codecs. For example works using mpeg or webm but
not with mp4 (x264) The WritePacket callback is always called but the produced
mp4 file is not readable from mplayer or cvlc. The webm or mpg files work well
instead.
Can you help me? I cannot find the solution or an example.
Please, help me!
If you want I have write an example using qt libraries.
--
www.denisgottardello.it
Skype: mrdebug
Videosurveillance and home automation!
http://www.denisgottardello.it/DomusBoss/DomusBossIndice.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120130/a22b3b5e/attachment.html>
More information about the Libav-user
mailing list