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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th April 2009, 09:54   #1  |  Link
aviadr1
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
aviadr1 is offline   Reply With Quote
Old 27th April 2009, 14:45   #2  |  Link
Guest
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);
	}
Guest is offline   Reply With Quote
Old 27th April 2009, 15:42   #3  |  Link
aviadr1
Registered User
 
Join Date: Nov 2007
Posts: 4
it works, thanks!
aviadr1 is offline   Reply With Quote
Reply

Tags
h264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.