How can I get the information from a .dat file in order to create a new video file in .avi file format
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2016-2-22
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!