There are two sample video files in the input directory: football_cif.yuv and stefan_cif.yuv. Both are 90 frame clips of uncompressed video (CIF) stored in YUV format.
I have written two m-files the students can use – yuv2mat.m and mat2yuvfile.m – which handle input/output between matlab and output .yuv files.
Also included are two m-files that the students will be expected to write – cif2qcif.m and computedcimage.m – where cif2qcif.m downsamples CIF video to QCIF and computedcimage.m computes the DC image of the original CIF video.
There are two executables – YUVviewer.exe and mpeg2encoder.exe – which will be used to both view the uncompressed video and encode the video to mpeg format. Also associated with these executables are a few parameter files (*.par)
Below I have outlined the steps for one of the video sequences (football_cif.yuv):
MATLAB code:
% Load the data into matlab
[Y, U, V] = yuv2mat('input\football_cif.yuv', 'cif');
% Convert to qcif format
[YQ, UQ, VQ] = cif2qcif(Y, U, V);
% Save the qcif video out to file
mat2yuvfile('football_qcif.yuv', YQ, UQ, VQ);
% Compute the DC image
[YD, UD, VD] = computedcimage(Y, U, V);
% Write the DC image out to file
mat2yuvfile('football_dc_cif.yuv', YD, UD, VD);
Next, to view the uncompressed video files:
Open YUVviewer.exe
Make sure QCIF is selected for frame size
Click Open File and select football_qcif.yuv
Click Play
To view the DC image video file:
Open YUVviewer.exe
This time, select Other for frame size and enter 44 x 36
Click Open File and select football_dc_cif.yuv
Click Play
Now, to encode the video sequences to mpeg:
Open a DOS prompt and cd to the appropriate directory
Type the following:
mpeg2encoder football_qcif.par football_qcif.mpg
Now, to encode the DC image to mpeg, type:
mpeg2encoder football_dc_cif.par football_dc_cif.mpg
1 SECTION 3112 UNIFORM ALLOWANCE (A) POLICE DEPARTMENT THERE
1 THE PARTICLES AND THEIR PROPERTIES THERE ARE TWO
1 WELCOME THERE IS A GREAT SIGNIFICANCE OF THE
Tags: files in, parameter files, video, sample, there, files, input