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

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Nov 29 13:11:26 EET 2016

2016-11-29 12:07 GMT+01:00 Sampsa Riikonen <sampsa.riikonen at iki.fi>:

> 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?

It calls libavcodec that does sps/pps parsing (this is the reason libavformat
depends on libavcodec).

Carl Eugen

More information about the Libav-user mailing list