[Libav-user] Unable to decode H.264 stream received via RTMP

Kalileo kalileo at universalx.net
Sat Apr 28 10:00:40 CEST 2012

On Apr 26, 2012, at 05:53 , Григорий wrote:

> So I'm doing the following:
> - Create a buffer
> - Get a video RTMP packet from the queue
> - Read 3 fields at the beginning of it - FLV flags (1 byte), AVC packet type (1 byte), and CompositionTime (24-bit integer)
> - If AVC packet type is 0, parse the rest of the packet as a decoder configuration record. Build AVCDCR with PPS, SPS, AVCProfileIndication, profile_compatibility and AVCLevelIndication and append it to the buffer.
> - If AVC packet type is 1 and there is something in the buffer, append packet (usually starts with 0x00000002) to the buffer, pass the buffer contents to avcodec_decode_video2 and clear the buffer.
> - If the buffer is empty, simply pass the packet to avcodec_decode_video2.
> At the moment when I call avcodec_decode_video2 with buffer contents (that consist of 2 AVCDCRs and one encoded frame), before lots of "no frame!" it prints "Current profile doesn't provide more RBSP data in PPS, skipping". I think I've made some progress but am still doing something wrong.

Are you taking into consideration that with h264 it can take a lot of frames passed to decoding before you get back the first decoded frame ? How long / how many frames are you decoding before you give up?

More information about the Libav-user mailing list