[libav-api] Decoding RTMP stream - h264

Attila Krüpl krupl.attila at gmail.com
Thu May 30 12:12:24 CEST 2019


Hi all,

I’m reading RTMP stream with LibRTMP ( RTMP_Read ). I’m processing the FLV
as follows:

-          I’m reading the header

-          I’m reading the tag

-          Getting the frame type codec byte out of the tag

-          If the codec is AVC, than I’m reading the package byte, and the
3 bytes of the composition time.

-          I’m passing the rest of the data to the av_parser_parse2 function

-          passing the parsed packet to the avcodec_send_packet function

-          calling the avcodec_receive_frame every time, when getting past
the avcodec_send_packet successfully.

Upon receiving metadata ( onMetaData ) I’m reading the AMF0 object, and
creating the h264 codec according to the metadata received.

The problem is, that avcodec_send_packet mainly returns with invalid data
error message, and even if it doesn’t avcodec_receive_frame returns with
EAGAIN error message.

This code works perfectly fine when I’m feeding in encoded data from own
source ( encoding raw data from camera device ), but it fails when I’m
trying to decode data taken from RTMP stream.

What else should be read / set to configure decoding? Can anyone please
help?
Best Regards,

Attila


More information about the libav-api mailing list