View Full Version : Extracting frames from *.YUV
ahmeddrira
19th March 2009, 01:49
HI
Im newbies here sorry for my bad english
i am preparing a projet about acceleration of the vidéo codec of H264 , I need some help
I have to know how the YUV vidéo file is structured and how can i extract frame from this file
I must read a header and extract some information then brows the file frame by frame .
so how can i do that ?
what information i find in the header ?
what carater i found when browsing the file represent a start of frame and the end ?
...
please help me .
i use C++ for developping
THANKS.
LoRd_MuldeR
19th March 2009, 01:53
It's raw YUV data. There's no header.
That's why you must pass the resolution, the framerate and the framecount manually to x264 when working with *.yuv files...
ahmeddrira
19th March 2009, 01:56
sorry i don't anderstand you
my codec source have as input a *.yuv file
LoRd_MuldeR
19th March 2009, 01:57
sorry i don't anderstand you
my codec source have as input a *.yuv file
And, as I already told you, these files contain raw YUV data. There's no "header" in such files!
neuron2
19th March 2009, 03:09
Also, there is no delimiter character or string between frames. You know the frame boundaries only by knowing how many samples are there for each frame.
Dust Signs
19th March 2009, 07:21
Hi,
all the images in the byte stream are followed by one another with no delimiter in between.
Maybe the following image helps you understanding the structure of one picture (planar YUV 4:2:0): http://upload.wikimedia.org/wikipedia/en/0/0d/Yuv420.svg
Dust Signs
ahmeddrira
19th March 2009, 14:21
thanks a lot i andrestand many think but can is their a document or a thread to read it and andrestand more .
LoRd_MuldeR
19th March 2009, 14:48
thanks a lot i andrestand many think but can is their a document or a thread to read it and andrestand more .
You won't find many doc's about *.yuv files, as it's simply "raw" data dumped to a binary file.
There's no file format specifications for that. If at all, you should try to understand how "YUV 4:2:0" (aka "YV12") data is organized.
The image posted by Dust Signs may be helpful...
roozhou
19th March 2009, 18:59
The only thing you need to know is the resolution (assuming AxB, both must be even).
The size of each frame is A*B*1.5 Bytes. The nth frame locates at n*A*B*1.5 bytes.
Sagekilla
19th March 2009, 20:38
I think that applies when you're using a zeroed index. Otherwise, that would mean your 1st frame (for say, 320x240) starts at 115200 bytes. More accurately, that would be the first byte of the 2nd frame.
ahmeddrira
20th March 2009, 02:35
thanks a lot for your help . :)
Sagekilla
20th March 2009, 03:09
Just play around a bit and check before hand. I'm fairly certain from bytes [0, (width*height*1.5) - 1] is your "first frame," since there is nothing but video data in yuv.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.