[Live-devel] Decoding H264 non-IDR picture

Miladin Sajic miladin.sajic at citysync.co.uk
Fri Jun 20 07:12:48 PDT 2014


Thank you for your answers and suggestions.

Regards,
Miladin

From: live-devel [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Joshua Kordani
Sent: 20 June 2014 15:05
To: live-devel at ns.live555.com
Subject: Re: [Live-devel] Decoding H264 non-IDR picture

On 6/20/14 5:42 AM, Miladin Sajic wrote:
Hi,

I am trying to implement decoding of H264 NAL units that are received from the camera (using live555 rtsp streaming). Everything works fine if received NAL unit is IDR (see part of the code in PS) but it does not work for SLICE NAL unit (nal_unit_type == 1). To decode image this NAL unit is not enough on its own and reference needs to be made to all the units since last IDR unit (key frame with nal_unit_type == 5). I do not know how to implement this.

How to combine last IDR unit with the following SLICE NAL units  to produce H264 frame before sending it to the decoder?

[cid:image001.png at 01CF8C9A.19734270]

Can you give me any advice or point me to the right direction? Any help is greatly appreciated.




_______________________________________________

live-devel mailing list

live-devel at lists.live555.com<mailto:live-devel at lists.live555.com>

http://lists.live555.com/mailman/listinfo/live-devel
Sorry Ross for continuing the OT discussion, but just real quick.  The answer to your decoding question lies in the question itself, you said that non idr slices can reference any prior nal up to the last idr.  So in order to decode, you need to pass all prior nals up to the last idr.  How exactly you do this depends on the decoder library you're using, ie ffmpeg requires that you provide the full bitstream each call to the decoder, hence (sc = startcode)
sps sc pps sc idr       frame 1
sps sc pps sc idr sc slice      frame 2
sps sc pps sc idr sc slice sc slice    frame 3
and so on.

I can imagine a decoding library frontend that keeps track of the unchanging parts of the bitstream for you, and I wonder why it doesn't already exist, ie
you pass nals in receive order to the decoder library and then ask the library to give you a frame.  Eventually, once it has enough info, you get a frame back each call, while only having to briefly store the latest nal on behalf of the library.

I know this is OT, but if I'm mistaken someone please speak up.


--

Joshua Kordani

LSA Autonomy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140620/8d04d31e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1728 bytes
Desc: image001.png
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140620/8d04d31e/attachment-0001.png>


More information about the live-devel mailing list