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

Alex Cohn alexcohn at netvision.net.il
Wed Apr 25 19:59:34 CEST 2012

On Apr 25, 2012 8:27 PM, "Григорий" <grishka93 at gmail.com> wrote:
> Alex Cohn <alexcohn at netvision.net.il> писал(а) в своём письме Wed, 25 Apr
2012 17:54:44 +0400:
>> On Wed, Apr 25, 2012 at 16:45, Григорий <grishka93 at gmail.com> wrote:
>>> Andrey Utkin <andrey.krieger.utkin at gmail.com> писал(а) в своём письме
>>> 25 Apr 2012 17:29:09 +0400:
>>>> 25 апреля 2012 г. 15:52 пользователь Григорий <grishka93 at gmail.com>
>>>> написал:
>>>>> Hi all.
>>>>> I've built libffmpeg for Android and am trying to decode H.264 stream
>>>>> using
>>>>> it. I'm receiving that stream via RTMP connection and passing all
>>>>> packets (excluding first byte that contains flags related to RTMP) to
>>>>> avcodec_decode_video2 function. With H.263 it works perfectly, but
when I
>>>>> try to use the same code (only with codec ID changed) for H.264, every
>>>>> call
>>>>> to avcodec_decode_video2 returns -1 and nothing gets decoded.
>>>>> Here is the output:
>>>> Do you know libavformat can read and demux RTMP stream by itself?
>>>> Seems like problem in your demuxer, because decoding the frames it
>>>> produces fail.
>>> Yes I know, but I need more than simply receiving and playing, this
will be
>>> a kind of VoIP service. My demuxer seems to work fine - I am able to
>>> successfully decode audio using Speex and video using libavcodec when
it is
>>> encoded into H.263. Only problem is with H.264.
>> Packing of h264 into a stream is not trivial. You may find some
>> curious information at
>> Alex
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
> Thank you for this link. I've made it to parse the decoder configuration
record, extract SPS, PPS and some other things. I've tried to pass PPS and
SPS to avcodec_decode_video2 but it still returns -1, prints "no frame!"
and does not decode anything else. Prepending 0x00000001 before them or
making AVCDCR as described here
the same result.

H264 decoder expects SPS and PPS to arrive together with the first (IDR)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120425/feeda3ca/attachment.html>

More information about the Libav-user mailing list