Repository navigation
Add Custom Output (FFmpeg) mode for alpha channel recording - #190
Conversation
|
You can find a release here, if you want to try it out now: https://github.com/IsAvaible/obs-source-record/releases/tag/v0.4.8-alpha--ffmpeg-2 |
|
@exeldro Can we possibly get this? 🥺 |
|
I've just tried this in the update that was done a couple a couple of days go in OBS 33. I'm not sure if I am doing something wrong but I keep getting the filters background color when trying to record my spout2 source that already has alpha so I skipped the Chroma Key step. The the source record only work with the alpha if the alpha is made in obs with chroma key? like I can see in DaVinci that the alpha is being recorded but there is no alpha data due to the plugin adding a background colour where the alpha is? |
|
@libbierose to know what went wrong in your case I would need the settings you used and an OBS log file of a session with the issue. |
|
Thank you very much for your efforts to add FFmpeg custom command functionality. Thanks to your efforts, I am now able to record RGB color format video using Source Record.😍 |
Add Custom Output (FFmpeg) mode for alpha channel / transparency recording
Closes #162
Closes #151
Overview
Currently,
obs-source-recordroutes recordings through the standard OBS encoder pipeline (obs_encoder_t+ffmpeg_muxer). Standard OBS video encoders are strictly limited to opaque pixel formats (such as NV12 and I420) and drop any alpha transparency before frames reach the muxer. Consequently, recording sources with transparent backgrounds (e.g., green screen chroma keying, overlays, VTuber avatars, stinger transitions) into codecs like ProRes 4444 or QuickTime RLE loses the alpha channel.This PR introduces a Custom Output (FFmpeg) mode for recording, routing the source frames directly through OBS's built-in
ffmpeg_output(the same backend used by OBS Studio's native Settings -> Output -> Custom Output (FFmpeg)). Becauseffmpeg_outputmanages its own libavcodec encode and muxing, it directly preserves alpha channels and supports transparent pixel formats (such asyuva444p10le,argb, etc.).Key Changes
Custom Output (FFmpeg) Recording Pipeline:
ffmpeg_outputoutput instance instead offfmpeg_muxer.obs_output_set_media()andobs_output_set_mixers()respecting track selection (different_audio).mov,mkv,webm,mp4, etc.) are mapped to libavformat container identifiers.fragmented_movandfragmented_mp4, fragmented muxer flags are automatically appended for crash-resilient recordings.Alpha Channel Preservation:
ff_alpha).VIDEO_FORMAT_BGRA.ffmpeg_output's internal format selection detects the BGRA input and negotiates alpha pixel formats (e.g.yuva444p10lefor ProRes 4444).Encoder Presets & Safe Defaults:
prores): Fast Apple ProRes encoder with alpha (profile=4).prores_ks): Costlier reference encoder.qtrle): Lossless QuickTime animation with alpha.ffv1): Lossless video in MKV.libvpx-vp9): WebM alpha video.libx264.pix_fmtoptions from options string (sinceffmpeg_outputdictates the pixel format).scale_width/scale_heightwhen the user actually requests downscaling/upscaling, avoiding unnecessaryswscalepasses.Crash Prevention & Async Stop Hardening:
stop_output_async) with reference counting and weak source tracking (obs_weak_source_t), eliminating UI lockups and race conditions when encoders take time to drain.Video
You can find a short video on how the feature works in practice here:
https://youtu.be/_agfOjppnxw
How to Test
mov.prores) or QuickTime RLE (alpha) (qtrle).