How can I get the information from a .dat file in order to create a new video file in .avi file format
2 views (last 30 days)
Show older comments
I've actually tried to read my .dat file which is a binary file of a video, and after that tried to write as a .avi video file. The code that I wrote here is at the below of the post. Yet, when I was trying to play as a video by using vision.VideoFileReader method, I see a black screen and actually the video window itself is a black line vertically aligned in the screen.
v = VideoWriter('newfile.avi','Grayscale AVI');
open(v);
ffid=fopen('depth.dat');
A = fread(ffid);
writeVideo(v,A/255);
fclose(ffid);
close(v);
0 Comments
Answers (1)
Walter Roberson
on 22 Feb 2016
fread() by default returns a column vector of uint8 values. You would need to reshape() that to a 2 dimensional or possibly 3 dimensional array. Depending on the order the values were written, you might also need to exchange rows and columns with transpose() or permute()
0 Comments
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!