Video frames to one image

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
Xist

Re: Video frames to one image

Post by Xist »

ffmpeg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Video frames to one image

Post by anthony »

You would extract (somehow) every N'th frame and then merge them together using the appropriate compositing method.

For the examples given the moving element is always darker than the background, so a -compose Darken will do the trick...

convert video.mpg'[100,200,300,400]' \
-compose Darken -flatten merged_image.jpg

However you might get noise problems, as the darkest 'noise' pixels get preserved as well.

Other techniques involve isolating the 'changed' parts from a known 'background' image, to generate overlay masks. A two image example of this is given in IM Examples, Photo Handling, Double Exposers.
http://www.imagemagick.org/Usage/photos/#double

If you can provide use with an example video (preferably with just the desired frames, and a starting background image) then I can do a few experiments for you.

And please report what you discover back here for others, and posibly to let me add the final technique to the IM Examples, Video, page.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: Video frames to one image

Post by dognose »

I'm interested in this idea as well.

Here is a pic I'm using to try play with.

Image
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: Video frames to one image

Post by dognose »

[url=http://imageshack.us]Can you compose multiple images in one command?
If I use convert in.gif[0,1,2,3] -compose darken -flatten out.gif I get a black image.

Presumably the background color is being set to black by the GIF image file, so naturally black is darker than all the other frames.

Try this

Code: Select all

convert in.gif[0,1,2,3] -background white  -compose darken -flatten out.gif
As the first frame is darker than white it will replace the initial white background frame.
yudhist39

Re: Video frames to one image

Post by yudhist39 »

D:\wamp\www\ffmpeg\test_media>convert robot.avi robot.jpg
convert: Improper image header `robot.avi' @ avi.c/ReadAVIImage/1234.
convert: missing an image filename `robot.jpg' @ convert.c/ConvertImageCommand/2
710.




can anybody tell me, what's wrong with that error?
FYI, i'm using ImageMagick 6.4.7 Q16
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Video frames to one image

Post by anthony »

AVI is more of a meta file format with litterially hundreds of file formats (codecs) all known as AVI. IM can not know them all directly, though it does try.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply