Creating a video from a structure array field
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Md. Al-Imran Abir
am 11 Okt. 2021
Kommentiert: Md. Al-Imran Abir
am 2 Nov. 2021
I am trying to convert a structure array field (mov.cdata) into a video.
mov is a 1×600 struct with 2 fields (cdata and colormap). All of the values of cdata field are uint8 type and has a size of
. To convert it into a video, I wrote following code snippet:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/763806/image.png)
wm_video = VideoWriter('Watermarked_video_1.mp4', 'MPEG-4');
open(wm_video);
for m = 1:nFrames
%img = readFrame(mov(m).cdata);
writeVideo(wm_video, mov(m).cdata);
end
close(wm_video);
But I got the following error:
Frames of type double must be in the range 0 to 1.
How can this error be solved?
0 Kommentare
Akzeptierte Antwort
Kshitij Chhabra
am 14 Okt. 2021
Hi,
From my understanding you are trying to convert a structure array field into a video using the "writeVideo" function. You need to normalise your mov(m).cdata to fit in the range of 0-1 as mentioned in the documentation.
Hope this helps!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!