LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 04-28-2007, 10:28 PM   #1
zach014
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu
Posts: 16

Rep: Reputation: 0
converting animated gif to avi? (ffmpeg)


so far i've found out that it is possible to convert a gif to an avi file with ffmpeg
i tried it out and the output avi file didn't play very well
it played for fraction of a second in mplayer and stopped
can someone help me on this?
obviously i need it to last longer
here's what i did:
Code:
ffmpeg -i animation.gif -s 420x300 animation.avi
thanks in advance,
~zach
 
Old 04-28-2007, 10:39 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
You need to set the frame rate to a lower value. See the '-r' option in 'man ffmpeg'.
 
Old 04-29-2007, 08:17 AM   #3
zach014
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
do i change the frame rate for both the input and output files, or do i change it for just the output?

EDIT: ok, now it's saying it can't find the codec parameters for a gif file, and failed to make the avi

EDIT: alright, it worked again (i just went to /usr/bin and then did:
Code:
./ffmpeg -i /root/Desktop/animation.gif -s 420x300 animation.avi
however, when i change yje framerate to about 10, it still doesnt change it
same thing if i do something like 100

Last edited by zach014; 04-29-2007 at 08:34 AM.
 
Old 04-29-2007, 08:20 AM   #4
zach014
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
ok, now it's saying it can't find the codec parameters for a gif file, and failed to make the avi
 
Old 04-29-2007, 11:04 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
What command are you using?
 
Old 04-29-2007, 12:09 PM   #6
zach014
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Code:
./ffmpeg -r 10 -i animation.gif animation.avi
 
Old 04-29-2007, 12:46 PM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
I've never been able to get that to work. Try this instead:

convert test.gif test%05d.jpg
ffmpeg -r 5 -i test%05d.jpg -y -an test.avi

Change the rate as you see fit. This also gives you the opportunity to edit any frames that you need to, as it's not unusual for an animated gif to look somewhat screwy as an avi (the two media have different attributes). For example, there's no "transparent color" in an avi.
 
Old 04-29-2007, 01:05 PM   #8
zach014
LQ Newbie
 
Registered: Nov 2006
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
thanks!
it worked like a charm (except for some discoloration issues, which i fixed)
~zach
 
Old 10-09-2009, 10:11 AM   #9
gabrielvc
LQ Newbie
 
Registered: Sep 2006
Posts: 14

Rep: Reputation: 0
Thanks!!!

It also worked for me!
 
Old 04-22-2010, 08:09 AM   #10
mallrat
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by macemoneta View Post
I've never been able to get that to work. Try this instead:

convert test.gif test%05d.jpg
ffmpeg -r 5 -i test%05d.jpg -y -an test.avi

Change the rate as you see fit. This also gives you the opportunity to edit any frames that you need to, as it's not unusual for an animated gif to look somewhat screwy as an avi (the two media have different attributes). For example, there's no "transparent color" in an avi.
I've got some problems with output images quality with convert. I've used mplayer with -vo jpeg:
Code:
mplayer -vo jpeg animated.gif
ffmpeg -r 25 -i %08d.jpg -y -an animated.avi
BTW, mplayer shows the following:
for GIF: VIDEO: RGB] 330x201 8bpp 5.000 fps 0.0 kbps ( 0.0 kbyte/s)
but if I pass -r 5 to ffmpeg, I will got very slowly-running video. -r 25 works good for my case. I've tuned this value comparing last lines of mplayer's output for original and result videos.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Animated Gif Viewer? milkycow Linux - Software 5 01-06-2014 12:54 PM
How to create animated GIF TigerLinux Linux - Software 6 11-19-2005 08:29 AM
Animated Gif Editor??? m3s3lf Linux - Software 1 11-04-2004 06:27 PM
converting .tif images to an animated .gif file with a script illiniguy3043 Programming 2 06-01-2004 03:11 PM
converting .tif images to an animated .gif file (Red Hat 7.2, bash shell) illiniguy3043 Linux - General 0 06-01-2004 01:07 PM


All times are GMT -5. The time now is 06:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration