Resource icon

How to: Produce mathematically lossless video with alpha channel transparency in OBS Studio

Please note: if your goal is to produce visually lossless, high quality video, this isn't the place. With this, you'd be spending approximately 1932 gigabytes for 1 hour of recording at 1080p 60fps rawvideo (~4294967 Kbps).
This has been validated on OBS Studio versions 27.2.3 and 30.0.2. Since updates to OBS Studio may contain updates to the built-in FFmpeg, there is no guarantee that these settings remain valid after updates - but they generally should.


Known-good settings set 1 (rawvideo)
This has the lowest CPU usage but also the highest bit rates.

In Settings > Output, choose all of the following:
Output mode: Advanced
Type: Custom Output (FFmpeg)
Container: avi
Muxer settings: (leave empty)
Video bit rate: any value will be ignored
Keyframe interval: any value will be ignored
Rescale Output: off
(checked) Show all codecs (even if potentially incompatible)
Video Encoder: rawvideo
Video Encoder Settings: "pixel_format=bgr8" (without quotes)
Audio Bitrate: any value will be ignored is using a lossless codec like pcm_s16le
Audio Encoder: pcm_s16le (or any of your choosing)
Audio Encoder Settings: (leave empty)

In Settings > Advanced, choose all of the following:
Color Format: BGRA (RGB in v27 and older)
Color Space: sRGB
Color Range: Full


Known-good settings set 2 (targa)
This has higher CPU usage but may yield lower bit rates. Copy the settings from set 1, but change these:
Container format: mov
Video Encoder: targa
Video Encoder Settings: "pixel_format=bgra" (without quotes)


Troubleshooting
If your storage device is too slow, video may or may not write correctly. OBS Studio should be able to buffer encoded video in your RAM and write it to disk correctly, but if that fails, use a fast SSD instead, or lower your resolution and/or frame rate.
As always with MOV/MP4, you can add movflags=+frag_keyframe+empty_moov+delay_moov to muxer options to avoid losing the entire recording if it can't finalize properly.
How to play the recorded video
Most video players will fail to play lossless video produced in this fashion. If you're playing from a hard drive, expect some video buffering, similar to watching videos online with a slow internet connection. Here are a few video players I was able to validate for this purpose:
mpv (https://mpv.io): No issues, alpha works (checkerboard pattern). This is also the best choice for HDD users since you can specify a larger RAM buffer and you can see how much of the video is loaded to RAM.
OBS Studio (https://obsproject.com): No issues, alpha works, sources behind are visible.
MPC-HC 2.0 or newer (https://github.com/clsid2/mpc-hc/releases/) has issues: Black background instead of alpha.
VLC 3.0.6 does not work. "Movies & TV" and "Windows Media Player" do not work.
Top