[FFmpeg-user] FFMpeg and callbacks

Denis denisgottardello at gmail.com
Sun Jan 29 20:52:10 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. The WritePacket callback are called but the file contains an unusable data.

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


More information about the ffmpeg-user mailing list