Chroma video format R8G8B8A8 - does vlc supports it ?

This forum is about all development around libVLC.
TarmoPikaro
Blank Cone
Blank Cone
Posts: 34
Joined: 01 Mar 2017 22:08

Chroma video format R8G8B8A8 - does vlc supports it ?

Postby TarmoPikaro » 06 May 2018 18:52

Hi !

I'm analyzing how to convert vlc output video stream to godot (game engine) suitable video format.

What I have initially tried out - from code similar to libvlcpp test application - I can select video format into which I want to convert input video stream.
https://sourceforge.net/p/vlc2/code/HEA ... in.cpp#l69

By default sample application uses RV32 chroma format, which stands for VLC_CODEC_RGB32
accoding to this file:
https://sourceforge.net/p/vlc2/code/HEA ... rcc.h#l219

When using this chroma video stream looks like this:

0x0BD80030 d7 00 00 00 d7 00 00 00 d7 00 00 00 d7 00 00 00 d7 00 00 00 d7 00 00 00 d7 00 00 00 d3 00 00 00
0x0BD80050 cf 00 00 00 cf 00 00 00 df 00 00 00 d3 00 00 00 d7 00 00 00 d7 00 00 00 df 00 00 00 df 00 00 00

If I'll using "RGB8" chroma format, then I suspect I'm switching video format to RGB8,
https://sourceforge.net/p/vlc2/code/HEA ... rcc.h#l209

And output buffer looks like this:
0x0C080030 51 52 51 70 51 52 51 52 36 52 51 52 51 70 51 70 4b 70 51 70 69 70 69 8a 69 8a 69 8a 69 8a 84 8a
0x0C080050 69 6a 69 85 63 85 84 85 63 85 84 c0 b9 d9 d3 ec f7 fd f8 fd f8 fd f8 fd f8 fd fd fd fd fd fd fd

I suspect that buffer has red color 1 byte, green color 1 byte, blue color 1 byte, repeating itself, but not 100% sure.

Meanwhile godot has it's own conversion routines, which can be found from here:
https://sourceforge.net/p/vlc2/code/HEA ... rgb.h#l940

After godot performs conversion I can see in video buffer data like this: (Same video, should have identical conversion)

0x09860030 49 2e c7 ff 49 2e c7 ff 49 2e c7 ff 49 2e c7 ff 49 2e c7 ff 49 2e c7 ff 49 2e c7 ff 47 2c c5 ff 44 28 c2 ff 42 27 c0 ff
0x09860058 45 2a c3 ff 47 2c c5 ff 49 2e c7 ff 4d 32 cb ff 4a 34 cc ff 4b 35 cd ff 47 38 c8 ff 48 39 c9 ff 49 3e c9 ff 4c 41 cc ff

I suspect that this format is something like R8G8B8A8, here red byte is followed by green byte, followed by blue byte, and some alpha component.

Closest chroma which corresponds to this format is VLC_CODEC_RGBA, but there is no video_chroma plugin, which can perform such conversion.

I suspect that I'll create new video chroma plugin with same conversion routines as in godot, but would like to ensure that I'm not making something that already exists.

Can you tell me which video format I'm looking for and what could be it's name. Maybe also some plugin was written already to perform such conversion ?

TarmoPikaro
Blank Cone
Blank Cone
Posts: 34
Joined: 01 Mar 2017 22:08

Re: Chroma video format R8G8B8A8 - does vlc supports it ?

Postby TarmoPikaro » 06 May 2018 20:05

And answering to myself:

VLC_CODEC_RGBA is indeed correct video format, "RGBA" is correct chroma to request.

*pitch must be set to *width * 4 (4 bytes per pixel).

video_filter/swscale plugin performs conversion to RGBA chroma.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Chroma video format R8G8B8A8 - does vlc supports it ?

Postby Rémi Denis-Courmont » 06 May 2018 20:53

For performance reasons, you are most certainly better of keeping YUV chromas from VLC, and converting to RGBA using shaders in the game engine.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 17 guests