Skip to content

Instantly share code, notes, and snippets.

@ndarville
Last active September 30, 2023 18:56
Show Gist options
  • Save ndarville/10010916 to your computer and use it in GitHub Desktop.
Save ndarville/10010916 to your computer and use it in GitHub Desktop.
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.

To convert a part of a video file:

ffmpeg -i your_video.mkv -ss 00:00:10.000 -to 00:00:20.000 -c:v libvpx -crf 4 -b:v 1500K -vf scale=640:-1 -an output.webm
  • -ss is the start position in number of seconds, or in hh:mm:ss[.xxx] format. You can get it using your video player (Ctrl-G in MPC-HC).
  • -to is the end position.
  • -vf scale=640:-1 sets the width to 640px. The height will be calculated automatically according to the aspect ratio of the input.
  • -an disables audio. 4chan will reject your files if they contain audio streams.


Current limits for WebM files on 4chan are:

  • Maximum file size is 3072KB.
  • Maximum duration is 120 seconds.
  • Maximum resolution is 2048x2048 pixels.
  • No audio streams.
@frenchiveruti
Copy link

Thanks!

@hjpotter92
Copy link

gudie

guide*

@sheeit
Copy link

sheeit commented Apr 30, 2016

You might wanna see this for more options to encode in VP8.

@rlex
Copy link

rlex commented Sep 6, 2016

On mac os x and homebrew you need to to install ffmpeg with

brew install ffmpeg --with-libvpx

For -c:v libvpx to work.

@PeskyPotato
Copy link

PeskyPotato commented Mar 23, 2019

Audio streams are accepted by 4chan, they must be libvorbis so add -c:a libvorbis, you can also use one audio stream instead of 2 to reduce file size through -ac 1. This would result in:

ffmpeg -i your_video.mkv -ss 00:00:10.000 -to 00:00:20.000 -c:v libvpx -crf 4 -b:v 1500K -vf scale=640:-1 -ac 1 -c:a libvorbis output.webm

Another tip, if you exceed the 4MB file limit you can reduce the video bitrate from 1500K to something lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment