Reading frame from a 4K video?
Afficher commentaires plus anciens
I am reading a 4k video using the following code but all frames are black!
v = VideoReader('video1.mp4');
j=1;
while j<5
video = readFrame(v);
figure,imshow(video);
j=j+1;
end
3 commentaires
Cam Salzberger
le 31 Août 2017
Have you read further than the first 5 frames? Maybe the first second of the video is just black?
Can you also test your code with an example video file shipped with MATLAB? Does it work with 'xylophone.mp4'?
Also, can you clean up the code in your question so that it shows nicely in the question? It's hard to read when all jumbled together like that. If you use the "code" button in the edit bar, it will add two spaces in front of all the text, which will put it in a code block.
K M Ibrahim Khalilullah
le 1 Sep 2017
Cam Salzberger
le 3 Sep 2017
Hmm, that's odd that you wouldn't get the data, but also wouldn't see a codec error. MATLAB uses the OS' codec's for video reading and writing. Are you able to play the video correctly in Windows Media Player (if on Windows) on the same computer running MATLAB? If you're on Mac, check playing it with Quicktime. If Linux, try any program that uses GStreamer.
formats = VideoReader.getFileFormats()
Réponses (0)
Catégories
En savoir plus sur Video Formats and Interfaces dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!