Extracting frames from movie gives different sized images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dklemer

Extracting frames from movie gives different sized images

Post by dklemer »

Hello,

I am trying to use convert to extract frames from a .mwv file with a nominal size of 640x480 pixels. I have ImageMagick 6.5.8-8 2009-12-18 on Windows XP. I'm using convert with the following command:

> convert -deconstruct video_file.wmv image_file_%03d.jpg

which works great, except that some of the images are different sizes - some are 592x480, some 608x464, etc. I even tried using -resize 640x480 (which technically isn't correct, because the undersized images are more clipped than scaled), but the result is the same.

Does anyone have an idea about how to enforce the 640x480 size for every image? Any help would be greatly appreciated.

Thanks,
Dan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extracting frames from movie gives different sized image

Post by fmw42 »

If wmv is similar to gif animations, then the size differences are due to the fact that each new frame is just an update, not a complete frame. You might need to use -coalesce to convert each frame to a complete frame. see http://www.imagemagick.org/Usage/anim_basics/#coalesce
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extracting frames from movie gives different sized image

Post by snibgo »

The "problem" is the deconstruct, which will: "replace the second and later images with a smaller image of just the area that changed relative to the previous image".

If you don't want deconstruct, don't use it.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extracting frames from movie gives different sized image

Post by fmw42 »

Good catch Alan. I missed the -deconstruct and actually had to look that up just now as I have never used it. I don't do much with animations.

Learned something new today!

Fred
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extracting frames from movie gives different sized image

Post by snibgo »

I also had to look it up, but don't tell anyone.
snibgo's IM pages: im.snibgo.com
Post Reply