[Libav-user] avFormatContext initialization from AvPacket?

Maik coolkaefer12 at gmail.com
Wed Apr 24 17:21:25 EEST 2019

I'm getting raw H.264 data from a GenICam API call as a pointer to a buffer.

This pointer (as far as I examined it in gdb so far) does contain data that
can initialze an AvPacket structure by setting the AvPacket.data field to
the buffers address.

Beforehand I initialized an AvCodecContext structure with the parameters
that my received H264 data stream consists of (width/height, framerate,
codec type, etc.)

With this (the avCodecContext and the avPacket) I call

avcodec_send_packet (avCodecContext, avPacket);

and then 

avcodec_receive_frame( avCodecContext, avFrame); (with an allocated avFrame

Both calls return 0, which means that basically they succeded (looking into
the structures in gdb, I would say, the values are also reasonable as far as
I understand them).

Now, in order to proceed processing with avlib, I understand that I need an
AvFormatContext strucure somehow initialized. I read (and tested) many
examples, where the initialization of that structure takes place in
fucntions that also take a filename of a media file.
Since I'm not working with a loaded file here, but with raw data received
via an API call, I'd like to know, if it is somehow possible to initialize
an AvFormatContext struct with the data I have at hand (the raw buffer, the
avPacket and finally the avFrame)?


Sent from: http://libav-users.943685.n4.nabble.com/

More information about the Libav-user mailing list