Is there anyway to dissolve between the last/first frames?

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
LedZeppelin
Posts: 10
Joined: 2013-07-22T14:08:05-07:00
Authentication code: 6789

Is there anyway to dissolve between the last/first frames?

Post by LedZeppelin »

Is there a way to dissolve between the last few frames and the first few frames of a series of stills to create the effect of a seamless loop?

I have a series of about 30 images I generated with ffmpeg. The below syntax captures 6 images every 5 seconds.

Code: Select all

$ ffmpeg -i video.mp4 -ss 62 -r 6 -t 5 frames/ffout%03d.gif
Here's a sample of the effect which shows the last frames dissolve into the first few frames to produce a seamless loop.

http://25.media.tumblr.com/6f95f349e099 ... r2_500.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is there anyway to dissolve between the last/first frame

Post by fmw42 »

Is this a ffmpeg question of how to do that with it or how to do that with IM once you have the images from ffmpeg?

If the latter just add -loop 0 to the end of the image sequence when creating the gif animation.

convert -delay XX image1 image2 ... imageN -loop 0 animation.gif

see
http://www.imagemagick.org/Usage/anim_basics/#loop
LedZeppelin
Posts: 10
Joined: 2013-07-22T14:08:05-07:00
Authentication code: 6789

Re: Is there anyway to dissolve between the last/first frame

Post by LedZeppelin »

Thanks for the prompt reply but there may be a misunderstanding.

The animated gif I included has loops, and I know how to do that already. Do you notice how there is a dissolve transition at the end of the loop?

Is there a way I can produce that effect through image magick? I specifically looking for a way to dissolve after each iteration of the loop.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is there anyway to dissolve between the last/first frame

Post by fmw42 »

Not sure I understand. Do you only want to dissolve the last and first frames or dissolve between each of your frames? If so how may frames are produced?

See
http://www.imagemagick.org/script/comma ... .php#morph
http://www.imagemagick.org/Usage/anim_mods/#morph

or my scripts, shapemorph and shapemorph2 at the link below.
LedZeppelin
Posts: 10
Joined: 2013-07-22T14:08:05-07:00
Authentication code: 6789

Re: Is there anyway to dissolve between the last/first frame

Post by LedZeppelin »

Thanks for the quick reply! I only want to dissolve between the last and first frames given a series of about 30 frames total.

This command takes 6 frames a second over 5 seconds

$ ffmpeg -i video.mp4 r 6 -t 5 frames/ffout%03d.gif

Would I be able to dissolve the last and first frames given this set of 30 frames?
Last edited by LedZeppelin on 2013-07-25T21:27:04-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Is there anyway to dissolve between the last/first frame

Post by snibgo »

If you want to create a few frames that blend from the final frame to the first, see http://www.imagemagick.org/script/comma ... .php#morph
snibgo's IM pages: im.snibgo.com
LedZeppelin
Posts: 10
Joined: 2013-07-22T14:08:05-07:00
Authentication code: 6789

Re: Is there anyway to dissolve between the last/first frame

Post by LedZeppelin »

So would you recommend I create 2 animated gifs, one with the morphing sequence and the other of the non-morphing sequence. Then combine the two animated gifs?

As far as I could tell from looking at the documentation, there is no way to set the morphing sequence for a subset of an image series
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Is there anyway to dissolve between the last/first frame

Post by GreenKoopa »

Thank you for the example, but it is difficult to see what you mean. If you can define exactly what you want, it likely can be done. Do you want to add a frame at the end that is an average of the first and last frames? Or a longer transition of ??? frames?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Is there anyway to dissolve between the last/first frame

Post by fmw42 »

Take the last and first frames and morph them into as many frames as you want. Then combine the two animations into one.

convert -delay xx originalanimation.gif morphanimation.gif -loop 0 resultanimation.gif

One possible issue is that you need to be sure the morph delay (and number of frames) is consistent with the original set of images so that the combined animation is smooth.

see
http://www.imagemagick.org/Usage/anim_mods/#merge
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Is there anyway to dissolve between the last/first frame

Post by snibgo »

Perhaps the OP wants to dissolve (aka cross-fade) the last (n) frames with the first (n) frames, like a conventional cross-fade from one video clip to the next.

I would do that in a script, looping through the (n) frames, with an appropriate blend. The basic command is ...

Code: Select all

convert frame_000090.png frame_000001.png -compose Blend compose:args={x} -composite out_frame_1.png
... where {x} varies from zero to 100 in (n) steps, and the frame numbers increase.
snibgo's IM pages: im.snibgo.com
Post Reply