22nd October 2014

Post

Instructions to convert animated gifs to video files (using ffmpeg)

Animated GIFs: they’re hugely wasteful (at least 10x larger than their modern equivalent), slower to load, and playable almost nowhere outside of a browser (it’s bad when VLC Media Player won’t even animate a file). They were a great alternative to Adobe Flash for a few years, but we ought to be sharing MP4s now. So how can we batch convert a collection of these 90’s files to a modern video format?

First, install ffmpeg using MacPorts or HomeBrew. Then…you may want to work on a copy of your GIFs in case you screw something up and ffmpeg deletes your input file. That’s what command-line tools tend to do.

Mpeg4 videos

ffmpeg -i cats.gif cats.mp4

This works well for producing quality output without any complicated parameters, but if you want the video to be playable using Quicktime (Safari, QuickLook, Finder thumbnails, etc.) then you have to exercise a bit more control over the encoding.

ffmpeg -i cats.gif -c:v libx264 -crf 18 -pix_fmt yuv420p cats.mp4

Using the Constant Rate Factor encoder parameter with a value of 18 or less “should be visually the same as the input” but a lower value is better in my experience.

WebM videos

An MP4 won’t loop well. At least in my experience, no matter how smoothly the GIF loops, the MP4 will have a noticeable skip at the end. If you don’t mind losing the wide compatibility of MP4, then WebM works well in Firefox, Chromium, VLC, and some other software.

ffmpeg -i cats.gif cats.webm

But now the quality sucks because it has been compressed way too much thanks to ffmpeg’s encoder’s shitty defaults in this case.

ffmpeg -i cats.gif -codec:v libvpx -quality good -qmin 10 -qmax 20 cats.webm

Using the CRF parameter seems to do nothing, but changing the quantization values helped a lot. Qmax had to be brought down a lot from whatever the default is, to something in the 20 range. Higher, and I could see blocking. At about 20 I could hardly tell.

Converting an entire directory

All of the above is great and all, but if you have 1000 animated cat gifs, you can’t be bothered with all this. So here is a way to script the conversion, in bash at least.

for file in *.gif; do ffmpeg -i "$file" -codec:v libvpx -quality good -qmin 10 -qmax 20 "${file%.gif}.webm"; done

But a WebM Doesn’t Automatically Loop Like a GIF !

How to loop WebMs in a browser (tested in both Firefox and Chromium).

Animated GIFs with Transparent Colors

For GIFs like this, it’s a 2-step process. The first step is to “explode” the GIF into a series of JPGs with the transparency removed, and then animate a video out of those stills. You will additionally need to have imagemagick installed to do the first step. It will look something like this, but I didn’t test it.

convert cats.gif cats%05d.jpg
ffmpeg -r 5 -i cats%05d.jpg -y -an cats.mp4

Tagged: videoMP4gifanimatedtipsffmpegWebM

()

21st October 2014

Photoset reblogged from CIPATER.NET with 4,061 notes

If I can’t have my pizza, man, the zombies have won.

Tagged: Silent Hill 2KonamiscreenshotsPS2pizza

()

Source: laurakinneys

21st October 2014

Post reblogged from Animated Screenshots with 204 notes

animatedscreenshots:

image  image  image  image
image  image  image  image
image  image  image   image
image  image  image   image
image  image   image  image
Akumajō Densetsu

Tagged: Akumajō DensetsuNESCastlevania IIIscreenshots

()

20th October 2014

Photo reblogged from CIPATER.NET with 2,541 notes

Wednesday deadline, massive work remaining…

Wednesday deadline, massive work remaining…

Tagged: procrastination

()

Source: lucariio

20th October 2014

Photoset reblogged from Timeless Desperation with 8,816 notes

Tagged: animescreenshotsbe real

()

20th October 2014

Photoset reblogged from Talk Hinata To Me with 774 notes

hinatahearsahope:

NEVER FORGET BURRITO-KUN

When I want Chipotle but get out-voted.

Tagged: ChipotleburritosDangan Ronpaanimescreenshots

()

20th October 2014

Photo reblogged from Timeless Desperation with 107,143 notes

Tagged: insomniacoffeesleep disorder

()

Source: naughtbutlines

20th October 2014

Photo reblogged from lunch with 4,710 notes

Tagged: animelate nightprison

()

Source: genocidersyo

20th October 2014

Photo reblogged from lunch with 69,333 notes

They’re just vegetarian puppies with wings.

They’re just vegetarian puppies with wings.

Tagged: fruit batflying fox

()

Source: our-amazing-world

19th October 2014

Photoset reblogged from Timeless Desperation with 22,936 notes

Tagged: gamesadult lifefunemploymentplansfuture

()

Source: michiru-matsushima