will.I4M
will.I4M

Reputation: 343

decode raw buffer with ffmpeg av_codec_video_2

I'm trying to write a decoder for a webrtc app in C. I receive a RTP stream, I parse every packet, reorder them, and put the payload in a AVPacket, as described here (FFmpeg decode raw buffer with avcodec_decode_video2). The reordering part is not described in this link but I'm pretty sure this part is OK.

The question is, I dont know how to give the decoder information about resolution, pix_fmt etc. Do I need to create an AVstream* and fill it with all information I took from rtp header?

Do someone have a piece of running code that decode a VP8 packet depacketized without the use of rtp_dec etc.?

In this link, no more information seems to be sent to the decoder, is it able to decode without knowing resolution and without any header?

Upvotes: 0

Views: 1029

Answers (1)

ARK
ARK

Reputation: 699

You don't need to feed "resolution, pix_fmt etc." information to decoder, as those get derived by decoder from the input AVPackets.

Encoders need such information like resolution, pix_fmt etc. to generate the compressed byte/bit-stream. And, encoders embed this (resolution, pix_fmt etc.) information in generated bit-stream. Once decoder receives bit-stream in right order, it derives the resolution, pix_fmt info before proceeding to de-compressing it.

Probably, the packet order that you are feeding to decoder is the cause in your case.

Upvotes: 0

Related Questions