Question / Help "True Lossless"?

anihex

New Member
Hi guys!

One thing beforehand: If my question was already answered: Sorry. I tried to find a solution myself and if you read the whole post, I hope you MIGHT agree with me.

Alright. Let's get started.
I use OBS mainly for local Screencasts. I want to create high quality Tutorials. Since there's a lot of highlighted text in my video, the difference in color is quite noticble.

After I tried the settings posted in [Guide] How to make high quality local recordings I was surprised that the colors were still wrong. Or to be precise: They looked kinda blurry.
After I tested several settings in OBS I was wondering if the "Lossless" mode of x264 is actually lossless.
- I used crf=0
- I changed the settings of my video driver from 16-235 to 0-255.
- I disabled the hardware YUV->RGB conversion in VLC
The problem remained the same. So there are no playback issues.
But just to have it mentioned:
I placed the video-stream into an AVI-File to check with VirtualDub. And yes, even VirtualDub displayed "blurry colors".
Just in case someone doubts, I merely changed the container, this was my FFmpeg command:
ffmpeg -i obs_video.mp4 -c:v copy -an obs_video.avi

Seems legit to me. After a while I figured out what the problem was. Playing around with other lossless codecs showed me, that there's a problem with the colorspace. I had to change it from YUV to RGB. I tried this with x264vfw and it worked! The "blurry colors" were gone for good.

Now I tried to apply this to OBS so I can finally enjoy recording "True Lossless" with high speed. This is IMHO the main advantage over other software. I tried OBS and I get a very smooth 30 FPS. I can't check the FPS, but the resulting video is way smoother than my recordings with CamStudio i.e.
Guess what. I failed. I was unable to find an option to select the colorspace. Not in the "Encoding" area and not in the "Advanced" area either. So I looked up how to change the colorspace in x264. And I added those setting to the "custom x264 parameters".

Still no luck. It ignored my parameters and used YUV ... again ...
I tried the following parameters:
input-csp=rgb output-csp=rgb
and after that didn't work, I tried
-input-csp=rgb -output-csp=rgb
Once again: No luck.

After so many failures, I looked if I can change the colorspace in OBS using google. I mean ... Maybe someone asked this and I just didn't find that.
I guess I suck at searching. But I didn't find much. I tried the Search-Function of the board and entered "Force RGB" (BTW: I tried "True Lossless" too...).
The only result was a 15 pages thread of an "outdated" version. And from what I saw I realy wasn't able to get this. Sorry for beeing dumb here!
According to Krazy, OBS uses yuv420 instead of RGB.

Long story short: (finally)
Is it possible to have "True Lossless" (RGB instead of YUV)? Or is this "True Lossless" and I just have to convert the colors in some way?

I hope this isn't too confusing. :D
And please ... Don't tell me the "slightly loss of quality" would be fine. If it were, I wouldn't ask for help. ;-)

Thanks in advance. :)
 

R1CH

Forum Admin
Developer
4:4:4 color space was supported at one time, but not any more. What do you plan on doing with these videos that isn't going to eventually output or encode them in a reduced colorspace anyway?
 

anihex

New Member
Thanks for your fast reply!

I want to create basic programming tutorials. I'm using the free version of Lightworks for this. This beeing said, Lightworks is somewhat picky when it comes to codecs and containers.
  • H264 in AVI/MOV/MP4? It tries to convert the file to Matrox. And this takes forever and often fails on my computer. I'm not exactly sure why though.
  • MJPEG in AVI/MOV? AVI is not a good idea. But MOV works like a charm!
  • LJPEG? Not working at all.
  • Lagarith in AVI? Seems to work.
Granted, MJPEG isn't lossless. But unlike H264, I can't see any differences.

RAW: Desktop / Source Code
MJPEG: Desktop / Source Code
H264/OBS: Desktop / Source Code

I know. Both, H264 and MJPEG, lack the "lossless" attribute. But if I can import Lagarith, I can easily convert the MP4 files created by OBS to AVI and then convert that to a Lagarith video.
But if you take a look at the more importan part - the source code - you'll notice that OBS affects the quality more than MJPEG. At least for my needs.

I hope this qualifies as a "proper answer". :)
 

Grimio

Member
I am no expert on this, but after googling for a while it seems to be a limitation of not supporting 4:4:4 color space.
You can try and avoid the colors that cause problems as a workaround.
 

anihex

New Member
I'm not exactly sure to what you're refering. x264 supports yuv444 for sure.
ffmpeg said:
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.

And MJPEG seems to do the same:
ffmpeg said:
Incompatible pixel format 'rgb24' for codec 'mjpeg', auto-selecting format 'yuvj444p'

The idea of going around the colors might be a solution. But since I want to record it as close to the "default" as possible, I can't do that this easily.
I guess if I can't use yuv444p or RGB24 (ffmpeg can't use rgb24/rgb32 either), I think I'm using my small screencast-batch file. :)

For those who are curious:
@echo off
timeout /T 20 > nul
set Datum=%date:~6,4%_%date:~3,2%_%date:~0,2%
set Zeit=%time: =0%
set Zeit=%Zeit:~0,2%_%Zeit:~3,2%_%Zeit:~6,2%
set FileName=screencast_%Datum%__%Zeit%.avi
ffmpeg -f dshow -i video="UScreenCapture" -r 30 -c:v libx264 -an -crf 0 -preset veryfast %FileName%
pause

ofc this can only be used for "desktop recordings". Games are impossible this way. And I think OBS is a great tool for games. The quality loss there isn't as noticeable as on the desktop. If you can tell any difference that is ...
 

Boildown

Active Member
I guess your search didn't turn up this thread: viewtopic.php?f=7&t=7784

Tl;dr: Version .552b was reported to still work for lossless recording using the Use444 option. Just download that version, set the option, and do your thing.

By the way, have you considered using FRAPS with "Force lossless RGB capture" enabled?
 

paibox

heros in an halfshel
YUV 4:4:4 encoding has indeed been disabled because it broke at some point, and due to not being very useful for anything no effort has been made to get it working again. People were also enabling it and then complaining about getting a black screen while streaming. (The h.264 decoder used by Adobe Flash does not support YUV 4:4:4, nor does it support 4:2:2 in any useful manner.)

But honestly, anihex, the main point here is that YUV 4:4:4 and RGB24 will offer you nothing of use when it comes to the final product. While some media players will be able to play the file, no online video stream/file players will be able to play it back (save for possibly VLC's ActiveX plugin), and even Blu-Ray discs use a 4:2:0 chroma subsampling format for the video on the disc.

If you understand the implications of "true lossless" not being useful for anything but your personal enjoyment, you can download and use version 0.552b and manually enable 4:4:4 encoding, but I would recommend thinking it over first.
 

anihex

New Member
Boildown:
Thanks for this thread. Seems like I realy am too stupid for a good search ... ;)
And the thing about fraps ...
I want to use software that's at least free to use. I even want to make a video about how to record and edit WITHOUT the need of spending money on them. And I think OBS does a great job here. The only thing I'd like to see here would be a FPS and maybe a time counter.
Like: How long am I recording/streaming?

paibox:
I understand your point completly. The only "use" I see for "true lossless" is - as I stated(?) recording of source code based videos where syntax highlighting is heavily used. And ofc I know that I will lose some info at some point. But it's fine to try to keep it as high as possible until the end, yes?
And no, I don't intend to break my current OBS now. I've posted a little script which I modified a bit. It's nothing special and the naming only works in germany (I guess). But for my personal use, it's fine. It get's the job done and I can still recommend OBS.

Thanks again. Realy. I didn't think I'd get this many responses.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Lossless, as well as a vast number of other codecs will most likely be supported in the rewrite.
 
Top