[Libav-user] Parse raw movie packet data into AVPacket

Matthew Einhorn moiein2000 at gmail.com
Mon Nov 7 16:49:39 CET 2011


On Mon, Nov 7, 2011 at 10:45 AM,  <dream01 at email.it> wrote:
> If you have a movie file and you need to extract frame (packet) from it,
> it's simply a matter of writing:
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> avformat_open_input(AVFormatContext **ps, const char *filename,
> AVInputFormat *fmt, AVDictionary **options);
>
> ...
>
> AVPacket packet;
> av_read_frame(formatContext, &packet);
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> But what if I don't have the movie file but only unparsed, raw packet data?
> These raw packet data are the same as the raw data contained into the movie
> file but I don't access them throughtavformat_open_input and therefore I
> can't use av_read_frame so FFmpeg doesn't parse them.
>
> How can I parse this raw data in order to build the corresponding AVPacket?
>
> I need to obtain an AVPacket identical to the ones provided by
> av_read_frame.

Have you looked into using custom IO calls like here:
http://cdry.wordpress.com/2009/09/09/using-custom-io-callbacks-with-ffmpeg/


More information about the Libav-user mailing list