Confused about the purpose of BGRA

Athenya

New Member
I don't understand what is the purpose of the option under Advanced -> Video since from all my testing no matter what you do, when the Colour Format is set to BGRA the video files will still be recorded in YUV 4:2:0. Shouldn't it be recording in BGRA under this mode or the very least record in YUV 4:4:4
 

prgmitchell

Forum Moderator
1755632182187.png
 

koala

Active Member
If the encoder isn't able to encode color format BGRA, it will encode in some format it knows. So you need to choose a proper encoder. If you use simple output mode and as quality "lossless quality", the utvideo software codec will be used, and this will record the full video data. I don't know if the A layer is included (transparency), but the visible colors definitely will.
 

Athenya

New Member
If the encoder isn't able to encode color format BGRA, it will encode in some format it knows. So you need to choose a proper encoder. If you use simple output mode and as quality "lossless quality", the utvideo software codec will be used, and this will record the full video data. I don't know if the A layer is included (transparency), but the visible colors definitely will.
That's what confuses me because my understanding is that either you do that or specifically pick custom output (FFmpeg) and add "colorspace=0" to the video encoder settings which is two really obtuse ways to get it to actually do something, and otherwise it seem to always just default back to recording in YUV 4:2:0, instead of something like YUV 4:4:4 which would be closer.
 

Suslik V

Active Member
Code:
01:19:01.844: [x264 encoder: 'advanced_video_recording'] settings:
...
01:19:01.857: [ffmpeg muxer: 'adv_file_output'] Writing file 'W:/Game Capture/OBS/2025-08//Dag 20 01-19-01.mp4'...
Neither selected x264 encoder nor mp4 media container doesn't support BGRA.

Advanced settings in OBS is not for casual (or everyday) use. Default in OBS is NV12 format. This is best for compatibility. In my opinion, if user made mistake - it should be easily visible, not masked with "very close by its features".
 

Athenya

New Member
I'm still just confused because as far as I can tell every single video encoder I have available always just seem to default the recording back to NV12 4:2:0. Would have at least expected it to default it to some kind of 4:4:4 format
 

Athenya

New Member
If you want 4:4:4, use color format i444.
Well I wanted to record something completely uncompressed and now I'm just confused on what the BGRA setting does and why it also choose to record in 4:2:0 when it's picked. Still haven't gotten an answer on either thing
 

Suslik V

Active Member
About lossless recordings.
I wanted to record something completely uncompressed
recommendation:
...use simple output mode and as quality "lossless quality"

Also, there are guides. There you can find other suggestions for lossless recordings with OBS:

About the setting.
what the BGRA setting does...
it sets OBS canvas pixel format to "packed uncompressed format" similar to AV_PIX_FMT_BGRA in FFmpeg and matches GS_BGRA for graphics processing (texture formats list: https://docs.obsproject.com/reference-libobs-graphics-graphics ). OBS uses graphics acceleration to compose its final image. OBS prepares all frames as textures, combines them and gets final texture that either matches the final format of the output or OBS converts it to requested YUV format. Canvas - is black empty space of specified size where you placing all your graphic sources.

About fallback mechanism.
...why it also choose to record in 4:2:0 when it's picked...
Most popular encoders, media containers and streaming services stores videos as YUV, not RGB. You are using "x264" encoder - it cannot record RGB-like pixel formats. The ".mp4" media container cannot store data that uses RGB-like pixel formats (".mkv" can) - this is by ISO standard for MP4 container. See ISO/IEC 14496-12 for details.

Maybe you want to ask why OBS instead of rising the error attempts to record at least "something"? There are many factors:
  • similar fallback mechanism in other utils (re-encoding with FFmpeg - it chooses best compatible pixel format even when format is not specified);
  • streaming to popular platforms (no RGB support, only YUV 4:2:0, because RGB-like or YUV 4:4:4 requires a lot of bandwidth);
  • developer about custom output: "Video format handling has also changed; it will now attempt to use the closest format to the current format if available for a given video codec." (source: https://github.com/obsproject/obs-studio/commit/d3f92ca5d6bea05f9659cec7524f2a34d03e8c16 was in OBS v0.8.0 long time ago, and there is other examples from other developers: https://github.com/obsproject/obs-studio/pull/3439 that protects this fallback mechanism in other parts of OBS);
  • my own opinion: users complains (it doesn't work! fix it! *ing program! I cannot stream! I streamed yesterday but now there is error! etc).
If you only want to know the answer to the question "why 4:2:0 and not 4:4:4?" then here is the code:
This is very simple algorithm "IF not valid THEN...".
When invalid pixel format specified for the x264 encoder, then it will be substituted with NV12 (4:2:0).
 
Last edited:

Athenya

New Member
About fallback mechanism.

Most popular encoders, media containers and streaming services stores videos as YUV, not RGB. You are using "x264" encoder - it cannot record RGB-like pixel formats. The ".mp4" media container cannot store data that uses RGB-like pixel formats (".mkv" can) - this is by ISO standard for MP4 container. See ISO/IEC 14496-12 for details.

Maybe you want to ask why OBS instead of rising the error attempts to record at least "something"? There are many factors:
  • similar fallback mechanism in other utils (re-encoding with FFmpeg - it chooses best compatible pixel format even when format is not specified);
  • streaming to popular platforms (no RGB support, only YUV 4:2:0, because RGB-like or YUV 4:4:4 requires a lot of bandwidth);
  • developer about custom output: "Video format handling has also changed; it will now attempt to use the closest format to the current format if available for a given video codec." (source: https://github.com/obsproject/obs-studio/commit/d3f92ca5d6bea05f9659cec7524f2a34d03e8c16 was in OBS v0.8.0 long time ago, and there is other examples from other developers: https://github.com/obsproject/obs-studio/pull/3439 that protects this fallback mechanism in other parts of OBS);
  • my own opinion: users complains (it doesn't work! fix it! *ing program! I cannot stream! I streamed yesterday but now there is error! etc).
If you only want to know the answer to the question "why 4:2:0 and not 4:4:4?" then here is the code:
This is very simple algorithm "IF not valid THEN...".
When invalid pixel format specified for the x264 encoder, then it will be substituted with NV12 (4:2:0).
I'm sorry to say this but half your answer doesn't really address what I asked, what is the actual purpose of BGRA if the only way to use it is to setup some really hyper specific settings in "simple mode" and outside of this it also always falls back to the format that's the least like it.

Besides how come this .mp4 file is encoded in RGB if the .mp4 container doesn't support it according to you???

1756757511596.png
 

Suslik V

Active Member
Color Space. Color Format. x264, libx264rgb. If all of this sounds similar for you then you shouldn't touch Advanced settings at all.

Only special version of x264 encoder accepts RGB at input - in OBS it is named "libx264rgb (libx264)" and accessible from the special output type named "Custom Output (FFmpeg)". By using this encoder you may get similar MediaInfo. Results may depend on OBS build, for details see: https://github.com/obsproject/obs-studio/issues/7345

Casual x264 encoder accepts only YUV at input. OBS can convert formats on the fly.

...BGRA if the only way to use it is to setup some really hyper specific settings in "simple mode"
That's why it is in Advanced settings. Lossless mode is very specific.

And as said above, Simple Output mode is not only the output mode that OBS supports. Some hardware also may benefits from the OBS RGB, for example, Decklink Output when acting as keyer.
 

Athenya

New Member
With all duo respect, this is getting nowhere and if you're gonna talk with a condescending tone then please at least get your details right instead of fumbling all the details, like for example above with this:
The ".mp4" media container cannot store data that uses RGB-like pixel formats (".mkv" can) - this is by ISO standard for MP4 container. See ISO/IEC 14496-12 for details.
 

koala

Active Member
What is the goal of your thread? Do you want to understand how OBS (and all the color format/color space stuff) works, or do you have a specific requirement for some specific project?

If you seek knowledge and understanding in general, I recommend you find appropriate readings through Google search or by asking one of the new KI chat tools, because this topic is so large you cannot explain in a single thread. Appropriate keywords are "color space", "color format", "video encoding formats", "digital video processing". Find out what 4:2:0, 4:4:4 actually means and what the difference is to the color space in comparison to that.

If you have a specific requirement, it's probably best if you describe the project's requirement to give the whole picture. Otherwise it may be we talk about a XY-problem and are not able to solve your initial issue. A simple wish "I want it so" isn't a requirement. You need a technical requirement, because the reasoning behind the requirement will lead to a decision to choose this or that encoding, format and color space to properly fulfill this requirement.
 

Suslik V

Active Member
...please at least get your details
Details. My logic was this: "ISO/IEC 14496 is applicable to MPEG-4".

-------------------------

I think, the main complaint here is that the OBS does not automatically set all the necessary parameters. Users expect amazing results just by changing one option. But anything that is not default in OBS requires many extra steps. In my opinion it is a task for a "wizard"-like dialog/form. OBS has one in the main menu Tools > Auto-Configuration Wizard. Is a wizard needed for advanced OBS users?

If you want to learn more about OBS, there are guides (some includes video tutorials):
Also, there is Help:
 
Top