Reputation: 1
I am trying to convert .yuv video into separate .y .u .v for each frame of a video.
suppose video has 60 frames then it should output total 180 files.
.y for 1st frame .u for 1st frame .v for 1st frame
.y for 2nd frame .u for 2nd frame .v for 2nd frame
.
.
.
.y for 60th frame .u for 60th frame .v for 60th frame
can anyone suggest how to do this?
note : There are some softwares available but they give .y .u .v for entire video (only 3 files as a output videoname.y videoname.u videoname.v).
Upvotes: 0
Views: 1096
Reputation: 45672
From Wikipedia
Y′CbCr is often confused with the YUV color space, and typically the terms YCbCr and YUV are used interchangeably, leading to some confusion; when referring to signals in video or digital form, the term "YUV" mostly means "Y′CbCr".
Lets assume the video is in YCbCr 4:2:0 8bpp plane-separated format with a resolution of 640x480, then all you need to do is:
For 1 frame
To extract Y-component
Read 640*480 bytes
To extract Cb-component
Read 640*480/4 bytes
To extract Cr-component
Read 640*480/4 bytes
Repeat for all frames.
The size for 1 frame is 640*480*3/2=460800 bytes
For other YCbCr formats, see http://www.fourcc.org/yuv.php
Upvotes: 1