[Libav-user] H264 stream width and height parameters from live streams

Sampsa Riikonen sampsa.riikonen at iki.fi
Tue Nov 29 13:07:48 EET 2016


Hi,

When reading AVPackets from a file, it is straightforward to pass 
correct parameters to the ffmpeg/vdpau decoder, i. e., we call

av_format_find_stream_info

and get the relevant data to "AVStream(s)".  Then we do:

av_codec_parameters_to_context(AVCodecContext,AVStream.codecpar[AVCodecParameters])

That populates correct parameters into AVCodecContext, namely, 
AVCodecContext->width, height, etc.

This works also with "raw" H264 streams (i.e., with ".h264" files), that 
are not "container" formats, such as matroska, etc..
.. so the only conclusion is, that "av_format_find_stream_info" does 
some kind of sps/pps packet parsing, right?

We would like to feed the ffmpeg/vdpau decoder with a live stream - in 
our case bitstream coming from the live555 library.

How are we supposed to dig out width, height, etc. parameters using 
ffmpeg ?  FFmpeg/vdpau decoder requires those parameters to be in place 
in AVCodecContext - otherwise it will crash (this is not the case for 
the normal "software" encoder).

Regards,

Sampsa











More information about the Libav-user mailing list