[Libav-user] using avformat with external hardware codec
Alex Cohn
alexcohn at netvision.net.il
Wed Aug 8 15:40:39 CEST 2012
On Wed, Aug 8, 2012 at 2:07 PM, Jan Pohanka <xhpohanka at gmail.com> wrote:
>> What parameters need to be set avformat? I have tried following code
>> (simplified).
>>
>> video_st = av_new_stream(os, 0);
>> video_st->codec->codec_id = CODEC_ID_H264;
>> video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
>>
>
> Ok. I have found that et least following parameters has to be set in codec
> struct.
>
>
> video_st->codec->codec_id = CODEC_ID_H264;
> video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
> video_st->codec->time_base = (AVRational) {1, 5};
> video_st->codec->width = 1600;
> video_st->codec->height = 1200;
>
> I still do not know whether it is not possible to get these parameters from
> encoded raw stream.
> I have tried the avformat_open_input() function, but it does not fill
> codec->width and height members for exapmle.
>
>
> best regards
> Jan
You can get this data from the SPS field (NALU in h264-speak) that
must precede the first frame. See
http://ffmpeg.org/doxygen/trunk/structSPS.html
More information about the Libav-user
mailing list