Page 1 of 1
How to convert a video into images
Posted: 2012-06-09T04:26:12-07:00
by msaad99
Im working in Matlab and i want to convert the frames of an avi video into separate images. and then i want to use all those frames to match them with some other images. Can anyone please tell how i can do that using imagemagick?
Re: How to convert a video into images
Posted: 2012-06-09T10:50:35-07:00
by fmw42
msaad99 wrote:Im working in Matlab and i want to convert the frames of an avi video into separate images. and then i want to use all those frames to match them with some other images. Can anyone please tell how i can do that using imagemagick?
Converting all frames of a video to images would take a lot of resources. I do not believe that IM allows you to skip or jump. Nevertheless, see
http://www.imagemagick.org/Usage/video/
Probably just
convert video.avi image.png
You did not say what output format you want.
As for comparing images, that can be done, but one image at a time or via a script that loops over each video image and compares to your reference image.
compare -metric rmse video_frame referenceimage null:
will report the rmse difference. You can choose other metrics. Note the above requires the two images to be the same size. There is another option (-subimage-search) that allows you to match a smaller reference to the videoframe and find out where it best matches within the videoframe.
see
http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/
Re: How to convert a video into images
Posted: 2012-06-09T11:18:37-07:00
by rich2005
As well as the above
To decompose an avi file to individual frames you can use ffmpeg on a command line.
The windows version of imagemagick comes with its own (slim) version, if you use linux there will be (a better version) in your distro repository.
the command is;
ffmpeg -i inputfile.avi -f image2 image-%07d.png (or you could use .jpg)
Best to put the inputfile.avi in an empty folder and run the command from there as even the smallest video will have lots of frames.
Not guaranteed as the avi format is just a wrapper and covers a multitude of sins.
Re: How to convert a video into images
Posted: 2012-06-10T21:23:17-07:00
by huyandhang
Its useful. Thank for all share!
___________________________________________________________________________________________________________________________________________________
Click here |
Home page
super mario bros games |
super mario games online
Re: How to convert a video into images
Posted: 2012-06-11T03:40:46-07:00
by msaad99
[/quote]Converting all frames of a video to images would take a lot of resources. I do not believe that IM allows you to skip or jump. Nevertheless, see
http://www.imagemagick.org/Usage/video/
Probably just
convert video.avi image.png
You did not say what output format you want.
As for comparing images, that can be done, but one image at a time or via a script that loops over each video image and compares to your reference image.
compare -metric rmse video_frame referenceimage null:
will report the rmse difference. You can choose other metrics. Note the above requires the two images to be the same size. There is another option (-subimage-search) that allows you to match a smaller reference to the videoframe and find out where it best matches within the videoframe.
see
http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/[/quote]
Thanks. Im new to all this so im having these problems. can you please tell me how to set a path to where my images are located?
Re: How to convert a video into images
Posted: 2012-06-11T03:41:39-07:00
by msaad99
Thanks. Im new to all this so im having these problems. can you please tell me how to set a path to where my images are located?
Re: How to convert a video into images
Posted: 2012-06-11T09:49:19-07:00
by fmw42
msaad99 wrote:Thanks. Im new to all this so im having these problems. can you please tell me how to set a path to where my images are located?
Either use cd command to change to that directory or preface each image with its path to the directory it resides.
cd path2images
convert yourimage ....
or
convert path2images/yourimage
Re: How to convert a video into images
Posted: 2012-06-12T18:19:42-07:00
by anthony
Also see the Common Image File Formats Section.. MPEG, M2V and AVI Movies
http://www.imagemagick.org/Usage/formats/#mpeg
Long answer short --- mplayer/mencode will do the deed.