How can I get the information from a .dat file in order to create a new video file in .avi file format

2 vues (au cours des 30 derniers jours)
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);

Réponses (1)

Walter Roberson
Walter Roberson le 22 Fév 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()

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by