Benigno's original webm guide

Warning
This might look convoluted and unnecessarily difficult, but it's worth it in the end.

Info
With this method you can memorize keybinds and make the process of creating clips of live streams in real time as fast as your computer can encode and as fast as you can think. In the process you can keep a backup of the whole match, a clip with audio to keep as record and a clip without audio to post on 5chins.

Under Construction

« Back to the main rentry


  1. Programs needed
    1. mpv scripts needed
      1. Optional user interface script
    2. Optional program for youtube streams/videos
  2. Keybinds
    1. Browser
    2. mpv
      1. streamsave
      2. mpv-webm
  3. Step by step
  4. Configuration files
    1. streamlink (.config/streamlink/config)
    2. mpv (.config/mpv/mpv.conf)
      1. streamsave (.config/mpv/script-opts/streamsave.conf)
      2. mpv-webm (.config/mpv/script-opts/webm.conf)

This guide requires you to use a terminal, know how to install streamlink and mpv on your computer, make a configuration file for both, and download two scripts for mpv, place them in the correct folder and make configuration files for both scripts.

Programs needed

mpv : Scriptable video player to watch, mark, crop and clip videos.
streamlink : Opens streams on mpv and records to a file as a backup.

mpv scripts needed

streamsave : to clip the stream as is, with audio and the same video format it is being streamed, to a file.
mpv-webm : to clip a webm from the saved file by streamsave, and encode it without audio so it can be posted on /sp/.

Optional user interface script

mpv-uosc : mouse friendly user interface that hides and reappears when your mouse gets far/near it's functions.

Optional program for youtube streams/videos

yt-dlp : makes streamlink and mpv able to play youtube streams, also lets you download youtube videos with metadata, subtitles, thumbnail, descriptions, etc. Regular videos will not open on streamlink, but will run on mpv and will let you directly use mpv-webm if you want to.

Keybinds

Almost every action has a keybind, memorizing keybinds makes the process faster and easier in the long run.

Browser

F12 : Open the developer console on a browser.
If you go to the network tab you can find the direct link to a video stream, it's usually the one with a .m3u8 extension somewhere in the link.

mpv

, and . : Go back and forth a single video frame.
The "," button goes back a frame, the "." button goes forward a frame.

l (aka lowercase L) : mark the start, end and then clear a loop on a video.
If you hit "l" once it marks the start, the second time it marks the end, the third time it clears all marks.
Useful for marking the start and end of the file saved by streamsave.

m : mute video.
If you mute before encoding the resulting webm will have no audio.

streamsave

CTRL+z : Save a marked segment to a file.
Save the loop previously marked as a separate file from the main one being recorded by streamlink.

mpv-webm

SHIFT+w : Open the encoding menu.
With the encoding menu open you can hit:

  • "1" to mark the start of a clip, just seek on the video to the exact frame you want the clip to start with and press "1".
  • "2" to mark the end of a clip, just seek on the video to the exact frame you want the clip to end with and press "2".
  • "p" to preview the resulting webm.
  • "e" to encode with your saved settings.
  • "o" for more options like changing video codec, height to scale to, target file size, frame rate, etc. Press "Enter" to confirm settings.
  • "c" to open the crop menu, where pressing "1" on the pixel your mouse is hovering will mark the upper left corner of the cropped zone, and "2" will mark the bottom right corner.

Step by step

  1. Find a stream that can be opened on mpv by streamlink. (Most of them work, it's trial and error. Some will give you error 403: Forbidden because they use some kind of authentication i don't know how to blend into a single url for streamlink to consume, if you find out how to please post in the thread)
  2. In a terminal you execute the command streamlink 'link to the stream' --record /home/user/partidos/-{time:%Y%m%d%H%M%S}.ts. This will create a new recording every time you open a stream, using a timestamp as filename.
  3. Wait for something interesting to happen.
  4. Mark a segment using the "l" (aka lowercase L) button two times, it doesn't need to be precise/frame perfect because this wont be the final clip.
  5. Press CTRL+z to save the raw segment to a file you can work on.
  6. Open that file in a new mpv window.
  7. Mute the video.
  8. CTRL+w to open the encoding menu.
  9. Mark the start with the button "1" and the end with the button "2".
  10. Encode with "e" and hope it's size is less than 4mb (/sp/'s upload size limit).
  11. Post it.

If step 10 fails, then you need to either change the target filesize to a lower one, scale the video to a lower height than the original, or a combination of both until it's watchable and under 4mb.

Sometimes if the file saved by streamsave is already under 4mb you can change the target filesize to 0 (for constant quality) and make the encoding faster.

Configuration files

verbose-player
player = mpv

default-stream = best
stream-segment-threads = 10
ringbuffer-size = 128M
hls-live-edge = 1
player-no-close

twitch-low-latency

Info
--player-no-close
Streamlink by default closes as soon as the stream source ends so hooking it up to short videos is painful without --player-no-close.

mpv (.config/mpv/mpv.conf)

# Cache
cache=auto
demuxer-thread=yes
demuxer-max-bytes=1000M
demuxer-max-back-bytes=1000M

[protocol.http]
hls-bitrate=max
stream-buffer-size=4k

[protocol.https]
profile=protocol.http

[protocol.ytdl]
profile=protocol.http

streamsave (.config/mpv/script-opts/streamsave.conf)

save_directory=/home/user/clipsWithAudio
output_label=timestamp

mpv-webm (.config/mpv/script-opts/webm.conf)

# Defaults to shift+w
keybind=W
# If empty, saves on the same directory of the playing video.
# A starting "~" will be replaced by the home dir.
# This field is delimited by double-square-brackets - [[ and ]] - instead of
# quotes, because Windows users might run into a issue when using
# backslashes as a path separator. Examples of valid inputs for this field
# would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows),
# and [[/home/john]] (on Unix-like systems eg. Linux).
# The [[]] delimiter is not needed when using from a configuration file
# in the script-opts folder.
output_directory=/home/user/clipsWithoutAudio
run_detached=no
# Template string for the output file
# %f - Filename, with extension
# %F - Filename, without extension
# %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube).
# %s, %e - Start and end time, with milliseconds
# %S, %E - Start and end time, without milliseconds
# %M - "-audio", if audio is enabled, empty otherwise
# %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled.
# More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template
# Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion
output_template=%F-[%s-%e]%M
# Scale video to a certain height, keeping the aspect ratio. -1 disables it.
scale_height=-1
# Change the FPS of the output video, dropping or duplicating frames as needed.
# -1 means the FPS will be unchanged from the source.
fps=-1
# Target filesize, in kB. This will be used to calculate the bitrate
# used on the encode. If this is set to <= 0, the video bitrate will be set
# to 0, which might enable constant quality modes, depending on the
# video codec that's used (VP8 and VP9, for example).
target_filesize=3750
# If true, will use stricter flags to ensure the resulting file doesn't
# overshoot the target filesize. Not recommended, as constrained quality
# mode should work well, unless you're really having trouble hitting
# the target size.
strict_filesize_constraint=no
strict_bitrate_multiplier=0.95
# In kilobits.
strict_audio_bitrate=64
# Sets the output format, from a few predefined ones.
# Currently we have:
# av1
# hevc
# webm-vp9 (libvpx-vp9/libopus)
# avc (h264/AAC)
# avc-nvenc (h264-NVENC/AAC)
# webm-vp8 (libvpx/libvorbis)
# gif
# mp3 (libmp3lame)
# and raw (rawvideo/pcm_s16le).
output_format=webm-vp9
twopass=yes
# If set, applies the video filters currently used on the playback to the encode.
apply_current_filters=yes
# If set, writes the video's filename to the "Title" field on the metadata.
write_filename_on_metadata=no
# Set the number of encoding threads, for codecs libvpx and libvpx-vp9
threads=16
additional_flags=
# Constant Rate Factor (CRF). The value meaning and limits may change,
# from codec to codec. Set to -1 to disable.
crf=-1
# Useful for flags that may impact output filesize, such as qmin, qmax etc
# Won't be applied when strict_filesize_constraint is on.
non_strict_additional_flags=
# Display the encode progress, in %. Requires run_detached to be disabled.
# On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms.
display_progress=auto
# The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc)
font_size=28
margin=10
message_duration=5
# gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a)
gif_dither=2
# Force square pixels on output video
# Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio
force_square_pixels=no
Edit

Pub: 23 Aug 2025 20:08 UTC

Views: 20

Auto Theme: Dark