1
   

How do you make a ANIMATED GIF pulled from a Youtube video?

 
 
Fri 7 Jul, 2017 08:39 am

 
View best answer, chosen by tsarstepan
centrox
 
  3  
Fri 7 Jul, 2017 10:23 am
Upload a video on your hard drive to EzGif.com, or you can paste some online video URLs, not Youtube ones but you can download them using Free Youtube Downloader to get the video on your PC's hard drive. Let EZGif do the conversion then download converted GIF. Maximum 60 seconds at 5 fps.


0 Replies
 
centrox
 
  3  
Fri 7 Jul, 2017 10:38 am
Here's a GIF I made using ffmpeg (a command line tool)
https://i.imgbox.com/cIg5N0jv.gif
I can post how you do it if you are interested.
tsarstepan
 
  1  
Fri 7 Jul, 2017 11:00 am
@centrox,
Please do! Very Happy Surprised Very Happy
0 Replies
 
centrox
  Selected Answer
 
  3  
Fri 7 Jul, 2017 11:11 am
If you are using Windows, download a Zeranoe Windows build of ffmpeg. Choose a static build. The one they suggest is probably the right one. It will be a zip archive. Extract ffmpeg.exe from this into a folder and put a copy of the file you want to convert in there too. The command looks like this

Note: input.mp4 is the input file I used. Change the name and extension to match your input file. Use quotes around it if there are spaces

Code:ffmpeg -i input.mp4 -ss 00:00:00.000 -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:10.000 output.gif


https://ffmpeg.zeranoe.com/builds/

if you are using Mac I can take a guess at what you have to do, and I know how to do it in Bash Shell in Linux, which is kind of like OSX shell.

I am monkeying around right now and will update later with better explanation of what the command options mean.



0 Replies
 
centrox
 
  2  
Fri 7 Jul, 2017 11:31 am
I have edited above a bit.

This part:

-ss 00:00:00.000

I think is the offset from the start of the video to where you want to start converting (that one clearly means the very start of the video)

This part is how much of the input file to convert

-t 00:00:10.000
-t 00:00:10.000

Format of both is hh:mm:ss.nnn

where:

hh is hours
mm is minutes
ss is seconds
nnn is thousandths of seconds

so the above example gives a gif using ten seconds of the input file.



0 Replies
 
centrox
 
  2  
Fri 7 Jul, 2017 12:01 pm
The advantage of a mature tool like ffmpeg is that there are zillions of guides out there, which you can find using Google. Here is just one

http://www.bugcodemaster.com/article/convert-video-animated-gif-using-ffmpeg
0 Replies
 
centrox
 
  2  
Sat 8 Jul, 2017 03:11 am
How does this look?
https://i.imgbox.com/eQxkfEf0.gif

3 MB in size.

What I found out:

The simplest way to make a GIF from a video is to use ffmpeg with no switches like this
Code:ffmpeg -i input.vid output.gif

However you will run into trouble if the video is long or high resolution (or both) because it will attempt to use every frame and leave the height and width unaltered. I tried it with the original Youtube video and ffmpeg eventually froze at which point the output GIF had reached nearly 1 gigabyte in size. If you want a GIF you can host online you will have to abide by file size limits.

So my first thought was, let's skip some frames! You can do this with the skip_frame switch. I thought, why not skip all the non-key frames? Most video compression algorithms work by having periodic 'key frames' which are encoded in full and then just encoding the changes since the last frame, until the scene has changed enough to warrant writing a new key frame. (When the differences become so big that the compression ratio becomes poor). As the key frames are where the original video encoder decided the image has changed, they might be interesting frames to include in the GIF.

So we include the skip_frame switch and the parameter is no_key, i.e. please skip the non-key frames (there are other things you can do like skip every nth frame etc)

Code:-skip_frame nokey


Also image size reduction is good, so let's shrink it down to something reasonable. The original video as I downloaded it is HD, that is 1920 x 1080. That's crazily big for an animated GIF. Around 240 pixels high is common. Keeping the aspect ratio of the original gives us 422 x 240.

Thus the -s switch for output size:

Code:-s 422x240


Put these together:

Code:ffmpeg -skip_frame nokey -i input.mp4 -ss 00:00:00.000 -s 422x240 -t 04:16.000 output.gif



0 Replies
 
centrox
 
  2  
Sat 8 Jul, 2017 03:39 am
I want to make one thing clear: I am in no way an expert at using ffmpeg; I just like noodling around and the above is just a report of an experiment. I am sure there are probably all kinds of clever refinements that people use.

Here is a page of reviews of GUI type converters; I haven't tried any of them

https://filmora.wondershare.com/animated-gif/best-video-to-gif-converter.html
0 Replies
 
 

Related Topics

Rockhead's Music Thread - Discussion by Rockhead
History of Gun Control - Discussion by gungasnake
How to save a video in favorites - Question by Visionman
What are your favorite Youtube channels? - Discussion by tsarstepan
The Impotence of Autogenerated Captioning? - Discussion by tsarstepan
YouTube - Question by anonymously99stwin
Cat walks dog on a leash... - Discussion by gungasnake
SEAL Video - Discussion by gungasnake
 
  1. Forums
  2. » How do you make a ANIMATED GIF pulled from a Youtube video?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/26/2024 at 04:18:54