- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use live555 to receive H264 video from a camera. As a result, I receive discrete NAL units with 1 byte headers
1 bit zero bit
2 bit nal_ref_idc
5 bit nal_unit_type
As I saw, the decoder searches for start codes. But there are no start codes in the NAL units. How can I feed these packets to the H264 decoder?
As I saw no PPS and SPS packets coming from the camera, but I get an SDP at the start of the streaming. How can I make PPS, SPS from that?
Thanks in advance,
Miki
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have also encountered the same problem.
I have tried to insert the delimiter (0x00000001) in front of every NAL unit and when the frame is complete, I feed it to the decoder.
However, "m_pH264Decoder->Init(m_pDecParams);" works fine.
But "m_pH264Decoder->GetInfo(¶ms);" fails with -998 (UMC_ERR_NOT_INITIALIZED).
How can this be when the Init was successful?
What can be wrong?
Do I have to use different setting for the decoder compared to when I'm decoding Annex B format (which works fine)?
Do I have to do something different?
Should every NAL unit be sent to the decoder separately, or should they be sent together as a complete frame?
Br,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I put the NAL units separately to the decoder. I think you have the problem with GetInfo, because you haven't fed SPS/PPS to the decoder before you called GetInfo. I initialize the decoder the following way:
- Init
- GetFrame with SPS NAL Unit
- GetFrame with PPS NAL Unit
- GetInfo
BR,
Miki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help!
However, I have problem finding the SPS and PPS NAL units...
The only NAL units I get looks like following:
I-frame first packet:
0x7C, 0x85, 0x88, 0x84, 0x00...
I-frame middle packets:
0x7C, 0x05, 0x79...
I-frame last packet:
0x7C, 0x45, 0xFA...
P-frames:
0x41, 0x9A, 0x20...
As I understand it, the first byte is the header, and NAL UNIT HEADER & 0x1F = NAL Unit type.
In my case this is 0x7C & 0x1F = 28 decimal, which I don't know what it is.
And 0x41 & 0x1F = 1 decimal, which is NAL SLICE.
So, where do I find the SPS and PPS NAL Units?
Br,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fragmentation unit: Used to fragment a single NAL unit over multiple
RTP packets. Exists with two versions, FU-A and FU-B, identified
with the NAL unit type numbers 28 and 29, respectively. Specified in
section 5.8.
I hope it helps.
BR,
Miki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Youre good Miki!
I get the SPS and PPS in the SDP and the NAL units are FU-A (non interleaved mode) and single NAL units.
GetInfo is ok now - I get the image resolution and so on.
Even though, GetFrame with SPS NAL Unit and GetFrame with PPS NAL Unit returns VM_NOT_ENOUGH_DATA.
But this is maybe ok? GetInfo returns OK.
However, I still have problems with the actual decoding. GetFrame for decoding the frame returns either VM_NOT_ENOUGH_DATA or UMC_ERR_INVALID_STREAM, depending on how I try to de-packetize and feed the NALUs to the decoder...
I haven't found in any spec how to do this. Neither in 3984 nor in Intel specs. Anyone who knows or can guide me?
I have tried several ways; feeding the NALUs separately to the decoder with the delimiter (0x00000001) in front of every one, sending the NALUs concatenated to the decoder (according to 3984 7.1) with delimiter in front of every NALU, and also with delimiter only in front of complete frame, and also with FU indicator and FU headers removed (3984 5.8)... and in some other ways too...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I feed the NAL units with the decoder one-by-one. They are complete(depacketized) frames(or other NAL units) and they start with the delimiter. It"s absolutely okay, to get the VM_NOT_ENOUGH_DATA. H264 decoder stores previous frames and use them to decode frames. It doesn't matter, if your stream starts with an IDR frame, the decoder will say VM_NOT_ENOUGH_DATA. After some frames buffered, it will start to return decoded frames. Anyway, you can get the buffered frames from the decoder calling GetFrame (using NULL for the in parameter).
BR,
Miki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, now it starts to work, but there still are problems!
If I set the resolution small enough (and compression high enough) so that I only get one NALU per frame, i.e. there are no fragmented frames, the decoder starts to decode the frames after a while and I can display the frames.
However, if the frames are too big for one NALU we get fragmentation and the decoder returns VM_NOT_ENOUGH_DATA forever.
Unless I make the image all black by covering the camera lens, then the frame size is smaller and fits in one NALU and the decoder starts decoding. After this "initiation" the decoder also works with fragmented frames. BUT the images are quite distorted!
Am I de-packetizing or defragmenting the frames wrongly?
3984 7.1 says: "If a decapsulated packet is an FU-A, all the fragments of the fragmented NAL unit are concatenated and passed to the decoder."
But there is no further information about how this is done. I have tried several methods; adding delimiters between each NALU or not, removing FU indicator and FU header or not etc. None works ok!
How should this be done,for the decoder to accept the fragmented frames?
Br,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I managed to solve it by changing the header of the first fragment to Single NAL Unit and then just concatenating the paylod of the following frames, without delimiters or headers.
Br,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is one Frame one GOP for the function h264Decoder->GetFrame?
Or is one Frame one picture?
best regards,
Gerd Groelohmann
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I feed the NAL units with the decoder one-by-one. They are complete(depacketized) frames(or other NAL units) and they start with the delimiter. It"s absolutely okay, to get the VM_NOT_ENOUGH_DATA. H264 decoder stores previous frames and use them to decode frames. It doesn't matter, if your stream starts with an IDR frame, the decoder will say VM_NOT_ENOUGH_DATA. After some frames buffered, it will start to return decoded frames. Anyway, you can get the buffered frames from the decoder calling GetFrame (using NULL for the in parameter).
BR,
Miki
any help plz??
thanks
Oleg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
any help plz??
thanks
Oleg
got it working, with the NULL for GetFrame() (it was my own bug that got in the way) - no need to do anything with the NALUs, just feed them one by one (after proper Init())
thanks!
O.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page