Create an animated gif from a Youtube video

url=http://www.youtube.com/watch?v=V5bYDhZBFLA; youtube-dl -b $url; mplayer $(ls ${url##*=}*| tail -n1) -ss 00:57 -endpos 10 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound
requires "youtube-dl" -- sure you can do this with wget and some more obscurity but why waste your time when this great tool is available? the guts consist of mplayer converting a video to a gif -- study this command and read the man page for more information mplayer video.flv -ss 00:23 -endpos 6 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound generates a 6 second gif starting at 23 seconds of play time at 5 fps and a scale of 400x300 start time (-ss)/end time (-endpos) formats: 00:00:00.000 end time should be relative to start time, not absolute. i.e. -endpos 5 == seconds after 0:42 = 0:47 end point play with fps and scale for lower gif sizes the subshell is a solution for the -b flag on youtube-dl which downloads the best quality video, sometimes, which can be various video formats $(ls ${url##*=}*| tail -n1)
Sample Output
http://imgur.com/Pnfcu.gif

12
By: zed
2010-07-18 02:11:39

1 Alternatives + Submit Alt

  • Creates a better looking gif than the original post via imagemagick processing high quality jpgs, rather than converting directly to gif from the video itself.


    0
    youtube-dl -o bun.flv http://www.youtube.com/watch?v=SfPLcQhXpCc; mplayer bun.flv -ss 03:16 -endpos 5 -vo jpeg:outdir=bun:quality=100:smooth=30:progressive -vf scale=320:240 -nosound; convert -delay 4 -loop 0 bun/*.jpg bun.gif
    joeyliechty · 2012-01-05 17:53:22 0

What Others Think

The -b option of youtube-dl is not supported, at least for version 2015.03.28
Buzzcp · 266 weeks and 5 days ago
Youtube is the best source for learning if you want to learn anything from youtube then you have to learn easily and free. Even get your free case study writers about the many skills that will help you to choose the field which will make you successful.
dywizic · 26 weeks and 1 day ago
http://onlineeducationconsultancy.com/cheapest-fastest-way-to-get-a-bachelors-degree/">Online bachelors-degree Online bachelors-degree is one of its kind's non-profit education consultant firm. We are devoted to exterminating all hindrances http://onlineeducationconsultancy.com/cheapest-fastest-way-to-get-a-bachelors-degree/
oliviaryaaan · 5 weeks ago
best dissertation writing services the best online dissertation writing agency in UK. We have a team of PhD certified writers that belongs to vast successful experience https://www.prodissertationwriting.co.uk/buy-dissertaion-paper-writing.php
oliviaryaaan · 5 weeks ago
cheap dissertation writing services We believe that conducting a dissertation or thesis is both a terrific challenge and an excellent chance. Your dissertation or thesis journey can be a time in your life when you find out to love and appreciate obstacles for the development in capability they cultivate, the life experiences https://dissertationlords.co.uk
oliviaryaaan · 5 weeks ago
buy dissertaion paper writing best dissertation writing services the best online dissertation writing agency in UK. We have a team of PhD certified writers that belongs to vast successful experience https://www.prodissertationwriting.co.uk/buy-dissertaion-paper-writing.php
oliviaryaaan · 5 weeks ago
cheap dissertation writing services cheap dissertation writing services We believe that conducting a dissertation or thesis is both a terrific challenge and an excellent chance. Your dissertation or thesis journey can be a time in your life when you find out to love and appreciate obstacles for the development in capability they cultivate, the life experiences
oliviaryaaan · 5 weeks ago
Data analytics service Data analytics service Maveric Analytics Hub is a globally acclaimed, statistical analysis platform providing competent, professional and renowned services to academia and corporations
oliviaryaaan · 5 weeks ago
British Dissertation Consultants British Dissertation Consultants ensures that your work is screened before submission under the strictest quality control measures. We assure that your dissertations
oliviaryaaan · 5 weeks ago
papers planet papers planet If you are a student and running late on the deadline to submit the assignment or need any assistance with your academic piece of writing but don’t have much time left for the submission then Papers Planet is there for your help
oliviaryaaan · 5 weeks ago
Paper Lords Paper Lords has always offered productive results to their customers, and they haven't failed to deliver their projects on-time. Our team always prioritizes the customers' requirements
oliviaryaaan · 5 weeks ago
Online Class Hub Online Class Hub is an association of professionals dedicated to serving students save capital and simplify their careers. Need more time to get everything done
oliviaryaaan · 5 weeks ago
Research Publishers Research Publishers is a globally acclaimed Research Publishers consultancy providing quality, expedition, and renowned expertise in the publishing of academic and corporate research
oliviaryaaan · 5 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: