Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
fuss:ffmpeg [2017/11/29 08:15] – [Install a Full FFmpeg Distribution on Debian] office | fuss:ffmpeg [2017/12/05 07:54] – [Convert Video to GIF Animation] office |
---|
ffmpeg -i dump.gif -vf "setpts=0.25*PTS" -r 7 final.gif | ffmpeg -i dump.gif -vf "setpts=0.25*PTS" -r 7 final.gif |
</code> | </code> |
* ''setpts=0.25*PTS'' will set the speed as 4 times the current speed, | * ''setpts=0.25*PTS'' will set the speed as $4$ times the current speed, |
* ''-r 1'' will drop or duplicate frames to achieve 7 frames per second | * ''-r 1'' will drop or duplicate frames to achieve $7$ frames per second |
| |
Achieving an acceptable GIF is a games of push and pull between the value of ''-r'' and the value of ''setpts''. | Achieving an acceptable GIF is a games of push and pull between the value of ''-r'' and the value of ''setpts''. |
| |
| Other very useful filters are: |
| * ''decimate'' - will merge / drop duplicate frames hence lowering the GIF size, |
| * ''deflicker'' - will attempt to stabilize the video, |
| * ''scale'' - will scale the movie (down) and hence can be used to lower the file size |
| |
| In one pass: |
| <code bash> |
| ffmpeg -i a.gif -vf "deflicker, decimate=cycle=4, fps=8, setpts=0.35*PTS, scale=360:trunc(ow/a/2)*2" b.gif |
| </code> |
| the actions performed will be: |
| * ''deflicker'' - attempt to deflicker / stabilize the video, |
| * ''decimate=cycle=4'' - crop duplicate frames at a rate of $1$ duplicate frame out of $4$, |
| * ''fps=8'' - attempt to set the framerate to $8$ frames per second, |
| * ''setpts=0.35*PTS'' - speed up the movie by $0.35$ of the original speed. |