ホーム 暮らし [OBS Studio] Recording videos with transparent backgrounds (with alpha channel)

[OBS Studio] Recording videos with transparent backgrounds (with alpha channel)

真鍋 千夏 真鍋 千夏 • 更新: • 公開: • 読了約 28 分
目次

 Update (2024-10-11 09:15): Slightly added to the table of container formats and video encoders.

For those in a hurry, here is the conclusion:

nd33913cfa007
  1. Back up your profile (optional).

  2. Change "Color Format" in "Settings" > "Advanced" to "BGRA (8-bit)".

  3. Change "Output Mode" in "Settings" > "Output" to "Advanced", and select the "Container Format" and "Video Encoder" from the combinations below according to your needs.

 That's it. Now you just need to record.

Introduction

 Suddenly, have you ever thought, "I want video materials with transparent backgrounds for video production!"?
 I often do.
 You can use chroma key on GB (green back) or BB (blue back) materials to make the background transparent, but
the flaws at the boundary with the part erased by the chroma key can be bothersome,
or the subject might be green or blue, making it impossible to make it transparent cleanly in the first place...
 Especially for a VTuber like me,
there are many situations where I want to use footage of my avatar model moving as video material.

 This is a how-to article for those who "know how to import materials with transparent backgrounds into scenes in OBS Studio, but don't know how to record that scene in OBS Studio while keeping the background transparent...".

Reference Article

 This article is written by adding to and supplementing the information from this note article.

Author's Environment (as of 2024-10-11)

  • Windows 10 Home 64-bit 22H2

  • OBS Studio 30.2.3 (64-bit)

  • Media Player 11.2408.4.0

Setup Procedure

1. [Backup] Separate profiles to avoid breaking existing settings

 Since I will be changing settings that also affect streaming, I will create a profile specifically for recording transparent videos.
 To explain "Profiles" in OBS Studio simply, think of them as "units for saving settings".
(By exporting a profile and importing it on another PC, you can carry over your settings. By default, they are also automatically saved under AppData\Roaming\obs-studio\basic\profiles on the user's computer.)
 Separating profiles also has the benefit of making it easy to switch between settings for streaming and recording.

1-1. Select "Profile" > "New"
 Existing settings should already be saved in a profile called "Untitled" by default, so this time I will create a new profile for background transparency.
 * You can also use "Duplicate" to carry over current settings.
  In that case, follow the same steps as "1-2. Enter a profile name" to enter a name in the dialog that appears after duplicating, and then skip to "2. [Preparation 1] Change video color format to BGRA".

1-2. Enter a profile name
A "Add Profile" dialog will open; enter the name of the profile you want to create and click the "OK" button.
* It is safer
not to uncheck "Show auto-configuration wizard" below that.
This article will explain the process without unchecking it.

1-3. Auto-configuration wizard settings (Usage information)
Next, the "Auto-Configuration Wizard" dialog will open; select the usage information (purpose of use).
Since this is a profile for recording,
select "Optimize just for recording, I will not be streaming" and click the "Next" button.

1-4. Auto-configuration wizard settings 2 (Video settings)
Next, select the video settings.
Select the resolution and FPS you ultimately want for your video material, and click the "Next" button.
(Since this can be changed in the settings later, a tentative value is fine.)

1-5. Auto-configuration wizard settings 3 (Final results)
Recent applications are smart (?), so they will suggest settings based on your PC specs.

  • Recording Encoder

  • Recording Quality

  • Base (Canvas) Resolution

  • Output (Scaled) Resolution

  • FPS

You cannot change these suggestions at this point (as noted in the dialog, they can be changed from settings later), so click the "Apply settings" button.
* Please note that this article will not explain how to change settings that are not directly related to recording transparent videos.

This completes the backup (separating profiles).

2. [Preparation 1] Change video color format to BGRA

Next, we will change the settings for recording background transparent videos.
First, we will change the OBS Studio color format to include transparency (alpha channel) in the video.

2-1. Select File (F) -> Settings (S)

Or, select "Settings" in "Controls" at the bottom right

2-2. Change "Color Format" under "Video" in "Advanced" to "BGRA (8-bit)"
The "Settings" dialog will open; select "Advanced".
There is an item called "Color Format" under "Video" in "Advanced".
Change this to "BGRA (8-bit)" and click the "Apply" button.
* A stands for alpha channel (transparency channel), but
in older versions of OBS Studio, it may simply be
"RGB (8-bit)" or similar.
If you created a new profile, the settings have returned to default, so please also change the "Recording" "Filename Formatting" as necessary.

3. [Preparation 2] Change recording container format and video encoder

 Continuing with the setting changes.
 As some of you may know, .mkv (matroska), the recording file format selected by default in OBS Studio, also has a format (encoder) that supports alpha channels.
 However, since a format that does not support alpha channels is specified internally by default, it needs to be changed.

3-1. Change "Output Mode" to "Advanced" from "Output"
 First, if the "Output Mode" is the default "Simple", the options to change the container format and video encoder will not even be displayed, so change it to "Advanced".

3-2. Change "Type" to "Custom Output (FFmpeg)" from the "Recording" tab
 Next, since the "Type" item can now be selected in the "Recording" tab, change this to "Custom Output (FFmpeg)", where you can specify the container format and video encoder.
 This allows you to specify the recording format in detail for FFmpeg, which is installed along with OBS Studio.
 To briefly explain "FFmpeg", it is like an "application or tool that supports various video and audio codecs and encoders".
 If you have created a new profile, the settings will have returned to default, so make sure to change the "File path or URL" setting value as needed.

3-3. Specify a format that can handle transparency for "Container Format" and "Video Encoder" respectively
 Specify a format that can handle transparency in the "Container Format" and "Video Encoder" fields among the added options.
 Below are examples of combinations.

 The issue where recording is not possible if the audio sample rate is 44.1kHz when selecting webm was reported below.

 dpx is generally a less familiar format, but it is a major format in industries like film, so there are quite a few video editing software programs that support it.

 *mov is a QuickTime format, so it seems it is not supported by default on Windows.

 After further investigation into the issue of freezing or crashing when selecting libvpx-vp9, the response below stated that "it is an expert-level feature anyway, so the support priority is low"... (the ticket is also closed).


4. Display transparent images or transparent captures, etc., in the scene and record the video

 With that, the settings are complete, so all that is left is to record a video with a transparent background.

4-1. Place sources such as transparent images or captures of transparent 3D models in the OBS scene
 I will omit the operation method.
 By the way, please note that even if the background is transparent in OBS, it will bedisplayed as solid black.

 I am using VSeeFace

and Warudo

with background transparency settings and capturing them with Spout2.

*The following note article describes the procedure for VTube Studio, but please use it for reference.

4-2. Press the "Start Recording" button => Press the "Stop Recording" button

That is all.
Please confirm that the video file has been output.
*The quickest way to check if the background is transparent is to load it into OBS Studio as a "Media Source".

*The following is a text-based version of the content from the previous image of "Container Format" and "Video Encoder" combination examples, intended for search purposes.

  • avi (.avi) / v408 - Uncompressed packed QT 4:4:4:4 / Some audio encoders are not supported (MP3 or the encoder must be disabled). As it is uncompressed, the image quality is good but it is very heavy. Cannot be played on recent standard Windows media players (can be played in OBS).

  • avi (.avi) / utvideo - Ut Video / Some audio encoders are not supported (MP3 or the encoder must be disabled). Because it is lossless compression, the image quality is good but it is quite heavy. Cannot be played on recent standard Windows media players (can be played in OBS).

  • avi (.avi) / dpx - DPX (Digital Picture Exchange) image / Because it is uncompressed, the image quality is good but it is very heavy. Cannot be played on standard Windows media players (can be played in OBS).

  • avi (.avi) / png - PNG (Portable Network Graphics) image / Relatively lightweight. Cannot be played on standard Windows media players (can be played in OBS).

  • avi (.avi) / libvpx-vp9 - libvpx VP9 / Among those I tested this time, this is in the most lightweight category. Can be played on standard Windows media players. For some reason, in my environment, OBS Studio frequently freezes or crashes (the recording file itself is still exported).

  • matroska (.mkv) / dpx - DPX (Digital Picture Exchange) image / Because it is uncompressed, the image quality is good but it is very heavy. Cannot be played on standard Windows media players (can be played in OBS).

  • matroska (.mkv) / png - PNG (Portable Network Graphics) image / Relatively lightweight. Cannot be played on standard Windows media players (can be played in OBS).

  • matroska (.mkv) / libvpx-vp9 - libvpx VP9 / Among those I tested this time, this is in the most lightweight category. Can be played on standard Windows media players. For some reason, in my environment, OBS Studio frequently freezes or crashes (the recording file itself is still exported).

  • mov (.mov) / dpx - DPX (Digital Picture Exchange) image / Because it is uncompressed, the image quality is good but it is very heavy. Cannot be played on standard Windows media players (can be played in OBS).

  • mov (.mov) / png - PNG (Portable Network Graphics) image / Relatively lightweight. Cannot be played on standard Windows media players (can be played in OBS).

  • webm (.webm) / libvpx-vp9 - libvpx VP9 / Among those I tested this time, this is in the most lightweight category. Can be played on standard Windows media players. If the audio sample rate is 44.1kHz, it cannot be recorded. For some reason, in my environment, OBS Studio frequently freezes or crashes (the recording file itself is still exported).

同じカテゴリの記事

真鍋 千夏
デジタルマーケター 真鍋 千夏
プロフィールを見る →

美容と暮らしの話題を担当。メーカーの公式発表、商品成分の公表資料、専門家の監修記事をもとに事実を整理します。

おすすめの関連記事