[FFmpeg-devel] VQA v3
Vitor Sessak
vitor1001
Wed Mar 25 17:41:13 CET 2009
The Deep Explorer wrote:
>> Get the existing FFmpeg code compiled. Download some of the v1 and v2 VQA
>> files. Run a command like:
>>
>> ffmpeg -i file.vqa file.avi
>>
>
> I have been trying to understand the code flow ...put some av_logs to
> understand...
>
> the following ./ffmpeg -i aagun.vqa file.avi
> command gives me the following
>
>
> ############### avcodec_register_all #########
> ############### avdevice_register_all #########
> ############### av_register_all #########
>
> [vqavideo @ 0x88c0d90]
>
> ####### vqa_decode_init @@@@#########
>
> [vqavideo @ 0x88c0d90]
> nside after avctx->codec->init
> Input #0, wsvqa, from 'aagun.vqa':
> Duration: 00:04:58.93, bitrate: 88 kb/s
> Stream #0.0: Video: vqavideo, pal8, 320x156, 15 tbr, 15 tbn, 15 tbc
> Stream #0.1: Audio: adpcm_ima_ws, 22050 Hz, mono, s16, 88 kb/s
> File 'file.avi' already exists. Overwrite ? [y/N] y
>
>
> ############### entered av_encode #########
> ############### Video Codec CODEC_TYPE #########
> ############### Video found the right codec ######### 0
> [mpeg4 @ 0x88e6ae0]
> inside after avctx->codec->init
> [mpeg4 @ 0x88e6ae0]
> inside after avctx->codec->init
> ############### found the right codec ######### 1
> [mp2 @ 0x88e7030]
> inside after avctx->codec->init
>
> ############### Video Opening the Decoder with #########
>
> [vqavideo @ 0x88c0d90]
>
> ####### vqa_decode_init @@@@#########
>
> [vqavideo @ 0x88c0d90]
> inside after avctx->codec->init
>
> ############### Video Opening the Decoder with #########
>
> [adpcm_ima_ws @ 0x88c1340]
> inside after avctx->codec->init
> Output #0, avi, to 'file.avi':
> Stream #0.0: Video: mpeg4, yuv420p, 320x156, q=2-31, 200 kb/s, 15
> tbn, 15 tbc
> Stream #0.1: Audio: mp2, 22050 Hz, mono, s16, 64 kb/s
> Stream mapping:
> Stream #0.0 -> #0.0
> Stream #0.1 -> #0.1
> Press [q] to stop encoding
> [mpeg4 @ 0x88e6ae0]
> inside avcodec_encode_video
> frame= 304 fps=196 q=5.5 Lsize= 819kB time=20.27 bitrate= 331.1kbits/s
> video:631kB audio:162kB global headers:0kB muxing overhead 3.316194%
>
> Can someone tell me how does the first vqa_decode_init call takes place ?
> The first time what is the code path ?
>
> avcodec_open is getting called inside av_encode ( the function which
> controls everything)
> I got lost here ret = avctx->codec->init(avctx); in libavcodec/utils.c
> it seems that this is the one calling vqa_decode_init
> Am I right ?
Yes (init is a pointer to a function).
> My understanding is that first it is being decoded using the vqa
> decoder and then encoded
> into an avi container....and this is done frame by frame...calls take
> place at output_packet
> from where the decoder is getting called...
What you figured out of the FFmpeg internals is correct. But note that
we select "FFmpeg Small Tasks" that a student can accomplish without
having to know every corner of FFmpeg source. Since libavcodec is very
modular, you can improve (or write from the scratch) a decoder without
knowing much about ffmpeg internals. What is important for you to know:
1- the wsvqa demuxer split VQA video frames out of the vqa file
2- demuxers can pass data that is not frame-specific (flags in the
header, palette, etc usually stuff read from the header) to the decoder
through the extradata pointer
3- each one of the frames are passed by ffmpeg to the VQA Video decoder
by calling the decode_frame() method of the decoder.
4- ffmpeg calls decode_init() before sending any frames to the decoder
5- all ffmpeg needs from decode_frame() is that it fills the "void
*data" field with the decoded frame and data_size with its size in bytes
(that decoded frame will be by ffmpeg to the mpeg encoder, for example).
So all you really need to know that vqa_decode_frame() is called for
every frame with the encoded frame in *buf and it fills *data with the
decoded frame.
-Vitor
More information about the ffmpeg-devel
mailing list