I haven't done the coding part yet.
Before that i want to confirm this.
I have one gif image with transparent background.
I have one static image.
The static image is bigger than the gif.
So, I plan to resize(tile) the gif to the size of static first and then i want to mingle them.
Is it good way to do it?
Later i want to convert that gif to mp4 using ffmpeg.
I am using ffmpeg to convert gif to mp4. But the movie is not running in the same speed of the gif. Is it possible to make it run in the same speed?
Thanks
Best way to add gif over static image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Best way to add gif over static image
Resize isn't the same as tiling.
I don't know if ffmpeg can read animated GIFs. I would do it as ...
... where "10" is the desired framerate.
I don't know if ffmpeg can read animated GIFs. I would do it as ...
Code: Select all
convert in.gif -coalesce frame_%03d.png
ffmepg -i frame_%03d.png -r 10 out.mp4
snibgo's IM pages: im.snibgo.com
Re: Best way to add gif over static image
How do i find the framerate of an gif image?snibgo wrote:Resize isn't the same as tiling.
I don't know if ffmpeg can read animated GIFs. I would do it as ...... where "10" is the desired framerate.Code: Select all
convert in.gif -coalesce frame_%03d.png ffmepg -i frame_%03d.png -r 10 out.mp4
I found the scenes and delay time using identify function of imagemagick.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Best way to add gif over static image
Add the delays to get the total duration. Calculate the average delay for a framerate.
GIF files don't have a steady framerate. To get an MP4 from a GIF, you should replicate frames as needed so each one is on screen for the same time. I don't know if ffmpeg can do this automatically. If not, you coud replicate frames with ImageMagick, in a suitable script.
GIF files don't have a steady framerate. To get an MP4 from a GIF, you should replicate frames as needed so each one is on screen for the same time. I don't know if ffmpeg can do this automatically. If not, you coud replicate frames with ImageMagick, in a suitable script.
snibgo's IM pages: im.snibgo.com
Re: Best way to add gif over static image
snibgo wrote:Add the delays to get the total duration. Calculate the average delay for a framerate.
GIF files don't have a steady framerate. To get an MP4 from a GIF, you should replicate frames as needed so each one is on screen for the same time. I don't know if ffmpeg can do this automatically. If not, you coud replicate frames with ImageMagick, in a suitable script.
If there are 10 scenes and the delay is 5, i think the average is 5 after adding 5 for every scene.
(10 * 5) / 10 = 5
Did you mean something else. I didn't clearly get the point. It will be great to get any video format. Not just mp4.
The gif images are just 4 or 5 seconds in length. So after getting the mp4, I convert them to mpg and then i duplicate the mpg for 10 times and finally i convert them to mp4 to get some 30 sec or 1 min video. Is it the right way? Or will it work more better in other formats?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Best way to add gif over static image
The delay is shown as {ticks}x{ticks-per-seconds}. See http://www.imagemagick.org/script/comma ... .php#delay
So "5x100" means 5 hundredths of a second, 0.05s. If all the frames have this delay, then you have a steady framerate, which is 100/5 = 20 frames per second.
ffmpeg can create mpg, mp4, avi or many other formats. mpg files can be directly concatenated:
Unix: cat x.mpg x.mpg x.mpg x.mpg x.mpg >x5.mpg
Windows: copy /B x.mpg+x.mpg+x.mpg+x.mpg+x.mpg x5.mpg
So "5x100" means 5 hundredths of a second, 0.05s. If all the frames have this delay, then you have a steady framerate, which is 100/5 = 20 frames per second.
ffmpeg can create mpg, mp4, avi or many other formats. mpg files can be directly concatenated:
Unix: cat x.mpg x.mpg x.mpg x.mpg x.mpg >x5.mpg
Windows: copy /B x.mpg+x.mpg+x.mpg+x.mpg+x.mpg x5.mpg
snibgo's IM pages: im.snibgo.com
Re: Best way to add gif over static image
As i said, I am planning to use static image and one glitter to create animated image.
Using PHP GD, Using Imagemagick which is best in resource usage wise?
Thanks
Using PHP GD, Using Imagemagick which is best in resource usage wise?
Thanks
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Best way to add gif over static image
I don't use PHP, and don't know what "GD" is. In general, using more tools (such as a web browser with PHP interpreter) will also use more resources.
snibgo's IM pages: im.snibgo.com