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!