How to import .AVI files?

I am trying to import a .avi file for frame processing.

Import["c:\\windows\\clock.avi","Elements"] Import["c:\\windows\\clock.avi","VideoEncoding"] Import["c:\\windows\\clock.avi"] Import["c:\\windows\\clock.avi",{"Frames",{5,6}}] Out[115]= {Animation,BitDepth,ColorSpace,Data,Duration,FrameCount,FrameRate, Frames,GraphicsList,ImageList,ImageSize,VideoEncoding} Out[116]= rle8 Out[117]= {1,2,3,4,5,6,7,8,9,10,11,12} During evaluation of In[115]:= Import::fmterr: Cannot import data as video format. During evaluation of In[115]:= Import::fmterr: Cannot import data as video format. Out[118]= {$Failed,$Failed} 

It reports the same error with all avi files that I tested.

Any clues?

+4
source share
1 answer

AVI is a container format. You can encode movies with completely bizarre and rare formats and still call it .avi.

You can use a video format converter, such as freemake , to convert your movie into a format that Mathematica can use. Check with Internal`$VideoEncodings which internal formats are recognized.

Quite often, Quicktime (.mov) works the easiest. AVIs sometimes load just fine, but they don’t display at all, even if I have the correct codec on board and all my players can play it.

If all else fails, you can try VirtualDub . It can read AVI and split them into separate images that can be easily imported into mma.

EDIT
I recall from my last video project about a common AVI reading error that I received from the FireFox DownloadHelper plugin downloading a specific YouTube movie (although it played in all my players, VLC, Media Player Classic, Windows Media Players, etc.) . The conversion of DH to .mov worked, but DH inserts its logo into it. Therefore, finally, I resorted to downloading using FreeMake and converting to individual frames using VirtualDub.

+7
source

Source: https://habr.com/ru/post/1347787/


All Articles