[Live-devel] Decoding H264 non-IDR picture

Joshua Kordani jkordani at lsa2.com
Fri Jun 20 07:05:05 PDT 2014


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?
>
> 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
> 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/191ad824/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 1728 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140620/191ad824/attachment.png>


More information about the live-devel mailing list