Why can't I read video frames using 'VideoReader' on my XVID file after a Windows update?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 1 Fév 2022
Réponse apportée : MathWorks Support Team
le 1 Fév 2022
I have a simple MATLAB script that reads in some video frames from my video, which is in XVID format. Whenever I try to read these frames into an array, the array is empty. This can be seen whenever I try to write them to a video file. For example:
reader = VideoReader('xylophone.avi'); % XVID file\nwriter = VideoWriter('transcoded_xylophone');\n\nopen(writer);\nwhile hasFrame(reader)\n img = readFrame(reader);\n writeVideo(writer,img);\nend\nclose(writer);
I get an error message:
Warning: No video frames were written to this file. The file may be invalid.\n> In VideoWriter/close (line 282) In VideoWriter/delete (line 217)”.
When I debug this code, it's clear that none of the frames are being read - the variable ‘img’ remains empty during every loop iteration.
I'd like to know how to resolve this error. This issue occurs for every XVID file that I've tried. Note that this code used to work well for me, until I upgraded my machine from Windows 7 to Windows 10. This code works on my co-workers' machines, but it just doesn't work on mine.
Réponse acceptée
MathWorks Support Team
le 1 Fév 2022
Check which codecs you have installed on your machine. It's possible that you have multiple XVID codecs. For instance, Windows 10 has a native DMO MPEG4s decoder (which includes XVID), and if you have another codec installed, these may conflict.
Try uninstalling any additional codecs that you have installed for this format, then try your code again, then troubleshoot from there if the problem persists.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!