Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
27th April 2009, 09:54 | #1 | Link |
Registered User
Join Date: Nov 2007
Posts: 4
|
H.264 convert from bitstream to bytestream [annex b]
Hi,
as $subj I tried just replacing the 4-byte nal-size with an 00 00 00 01 startcode but it didnt work. does anyone have sample code to do this conversion or can explain what I'm missing? Aviad |
27th April 2009, 14:45 | #2 | Link |
Guest
Join Date: Jan 2002
Posts: 21,901
|
Perhaps you nade a coding error (such as assuming that the length value includes the length field).
I do the same thing to support MKV files. For each extracted frame (b points to the extracted frame buffer), I do this: Code:
// Convert to Annex B NALUs if necessary. p = b; while (p < (unsigned char *) b + FrameSize) { nalu_len = (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; p[0] = 0; p[1] = 0; p[2] = 0; p[3] = 1; p += (nalu_len + 4); } |
Tags |
h264 |
Thread Tools | Search this Thread |
Display Modes | |
|
|