Skip to content

Instantly share code, notes, and snippets.

@tulanght
Forked from vmu9999/4chan-webm-guide.md
Last active April 4, 2025 13:29
Show Gist options
  • Save tulanght/cf27f7dbfb57ef5f5c39 to your computer and use it in GitHub Desktop.
Save tulanght/cf27f7dbfb57ef5f5c39 to your computer and use it in GitHub Desktop.

4chan Audio WebM Guide

Download FFmpeg https://www.ffmpeg.org/download.html FFmpeg is a command line tool, which means there is no GUI. You are going to have to input commands via the keyboard instead of clicking the mouse.

Current Limitations for WebM files on 4chan are:

Maximum file size is 4096KB.
Maximum duration is 300 seconds.
Maximum resolution is 2048x2048 pixels.
Audio streams allowed.

Convert a portion of a video file to WebM:

ffmpeg -i input.mkv -ss 00:00:10.000 -to 00:00:20.000 -c:v libvpx -c:a libvorbis -crf 4 -b:v 1500K -vf scale=1280:-1 -threads 4 -an output.webm

  • -i specifies the input file you want to transcode to webm.
  • -ss specifies the start position in number of seconds, or in hh:mm:ss[.xxx] format. You can obtain the timecode using your video player (T in VLC and Ctrl-G in MPC-HC).
  • -to specifies the end position in number of seconds, or again in hh:mm:ss[.xxx] format.
  • -c:v specifies the video codec to use. webm isn't actually an encoding type unto itself, but an audio/video container, like mkv. Nevertheless, you will almost always use libvpx for the video.
  • -crf sets CRF value. Must be from 4-63. Lower is higher quality. 10 is a nice starting point.
  • -b:v specifies the maximum allowed bit rate. Higher means better quality.
  • -vf scale=1280:-1 sets the output video width to 1280px. The height will be calculated automatically according to the aspect ratio of the input. Simply omit this parameter to keep the files original resolution.
  • -threads 4 tells FFmpeg to use multithreading. Enter the number of cores your processor has as a parameter, or set to 0 to use them all.
  • -c:a libvorbis specifies the audio codec for the output file.

Converting Animated gifs: ffmpeg -i input_gif.gif -c:v libvpx -crf 10 -b:v 500K output.webm

FFMpeg documentation: https://www.ffmpeg.org/ffmpeg.html

@neau
Copy link

neau commented Jun 18, 2019

The only boards on 4chan that allow WebMs with sound are /gif/ (nsfw) and /wsg/, the rest are muted.

@lee321987
Copy link

Option:
-an
removes/strips the audio.

@FabianLoRs
Copy link

Without audio??

@karelbilek
Copy link

Maximum duration seems to be 120 seconds now

@misha1350
Copy link

/wsg/'s file size limit seems to be 6MB (6144KB). Best to encode with 2-pass to reach 6000KB so as not to overshoot the requirement and to make the video look a little better, given the starved bitrate. VP9 and Opus is everyone's best friend, don't ever use VP8 or Vorbis. CRF at 10 is comically high, don't listen to OP.

Calculate your required total bitrate (for video and audio) with the following formula: 48000 / *seconds*. Don't know what the duration is (it's probably 6 microwave times (360 seconds)), but if the video is extra long, make sure to split it into 2-5 videos and send it all with several posts.

Opus's 64kbit/s are good for voice audio in stereo, 80kbit/s are good for JewTube's 128kbit/s AAC audio for music, and 160kbit/s are good for 320kbit/s music (if budget allows, set the bitrate to 192kbit/s to make the audio really indistinguishable from CD Audio). Going as low as 32kbit is also good. Below that you should convert the audio to mono and you can go as low as 12kbit/s.

@mirodno
Copy link

mirodno commented Dec 14, 2024

Don't listen to the previous speaker, VP8 is still an option for old crappy devices, both encoding and decoding (playback), VP9 is comically slow for most machines i tried. And if you consider posting outside of 4chan, there might still be an imageboards with no VP9 support, which is not as uncommon as you might think, 4chan itself got VP9 only in 2022, three years after the original post has been written.

Also, crf 10 is NOT comically high due to usage of -b:v parameter, which is actual ceiling here — with -b:v higher than 0, crf is used for better allocating bitrate stuff below -b:v value (although overshoot is still a thing, 2-pass for the mass), so you can go as high as crf 1 lol, but you better not, if you don't want to turn your encoding into basically CBR.

As for Vorbis, it sucks, but if compatibility is a serious concern, try experimenting with audio track separately (i.e. outside of webm container, extract if needed) starting from 64kb/s (UPD: pardon me, i meant -q:a 0). Downmixing to mono might help to save quality (or might not, it's Vorbis after all).

@gphg
Copy link

gphg commented Feb 24, 2025

Unlike mp4 encoding, webm is somewhat clearer. You can set the CRF as its lowest: 63 and it wasn't as bad as mp4.

This is my ffmpeg arguments:

ffmpeg -i input.mkv -c:v libvpx-vp9 -crf 32 -preset veryslow -b:v 0 -b:a 160k -c:a libopus output.webm

-b:a 160k if you value the audio, otherwise -b:a 80k. Tweak CRF at desired value.

I suggest you this for scene detections:
https://github.com/Breakthrough/PySceneDetect

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