Digital Video Forums  

Go Back   Digital Video Forums > Video File Formats > MP4, MKV, MPEG-4 AVC (H.264)

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10 Oct 2009, 06:01 AM   #1
Junior Member
Junior Member
 
Join Date: Oct 2009
Posts: 1
Unhappy Parser for NAL units

Hello,

Im a student from Brazil and I'm trying to do a program, using C,
that opens a .264 video and split the NAL units that are inside it...
im trying to write the bytes of the file in a .txt file...
but I am having some troubles...
First of all, i cant find the end or the beginning of the nal unit...
second, the first byte of the file is already different from the nal header that i was waiting for... the first 3 bytes always are 0 0 1.... and i dont know what it means....

my program is this:
(im not an expert when the subject is programming....)

#include <cstdlib>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string>

int main()
{

char filein[30], fileout[30];
unsigned char nalu[500000];
int nframes,n, luma_only, j, i, bl, upsample, a,b,c,d, m,p,nfr, wi, hi,w,h, nnalu, endofnal;
float prov;

printf("file name in: \n");
scanf("%s",filein);
FILE * pFile;
long lSize;
size_t result;
pFile = fopen ( filein , "rb" );

printf("file name out: \n");
scanf("%s",fileout);
FILE *fileopen;
fileopen = fopen ( fileout , "w" );


char ch; //Para a leitura dos caracteres
bl = 0; //count the num of bytes - not working
while ( fscanf(pFile, "%c", &ch) != EOF )
{
printf ("\n TESTE!\n");
i=0;
endofnal = 0;
while(endofnal==0)
{
i=i+1;
nalu[i] = fgetc(pFile);
fprintf (fileopen, "%d ", nalu[i]);
// if (i>4) {
if (nalu[i] == '3' || fscanf(pFile, "%c", &ch) == EOF)
{
endofnal = 1;
fprintf (fileopen, "\n Numero de bytes desta nal: %d\n", i);
bl = bl + i;
printf ("\n Numero de bytes desta nal: %d\n", i);
}

// }

}

}
fprintf (fileopen, "\n Num of bytes in file: %d\n", bl);
fclose(pFile);
fclose(fileopen);

printf("done!");
return 0;

}

someone have another way to do this??

is lika a parser for the nal units...

thanks anyway..

Xico
Xico Amorim is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UPS Units? drfsupercenter General Computing 20 15 Jun 2008 01:10 AM
GTA IV Sales Pushed More Xbox 360 Units Than PS3 admin Latest News 0 31 May 2008 12:55 AM
Hey Guys!! Keyboard/mouse/trackball units? JakeBlues General Computing 0 31 May 2007 10:19 AM
mpeg parser ramya General Discussions 3 16 Sep 2005 07:30 PM
??PC-DVD units can play all regions?? lisawebs DVD Encoding and Playback 6 16 Jan 2004 05:32 AM



All times are GMT +10. The time now is 02:17 PM.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 1999 - 2018 Digital Digest

Visit DivXLand   Visit dvdloc8.com