Question / Help How to record lossless quality

DeMoN

Member
Set the audio codec to pcm_s16le
_
UTVideo is a lossless codec and you capture RGB at 120fps.
You wont get it lower with a lossless codec. But thats your only option for vegas and a higher colorspace than 4:2:0.
But that shouldnt be of a problem, since you can delete your source after you're finished with your final encode.
The final encodes will benefit from such a good source too (better quality at filesize ratio)

edit2 : oh and the seekability of a lossless source is insane fast. You should notice it.
 
Last edited:

King Meow

New Member
Set the audio codec to pcm_s16le
_
UTVideo is a lossless codec and you capture RGB at 120fps.
You wont get it lower with a lossless codec. But thats your only option for vegas and a higher colorspace than 4:2:0.
But that shouldnt be of a problem, since you can delete your source after you're finished with your final encode.
The final encodes will benefit from such a good source too (better quality at filesize ratio)
That fixed the audio and yeah, I'll just deal with the large file size, I guess not everything can be perfect :p
It'll forever remain a mystery to me how Camtasia does this with small file sizes tho, lol.

But once again, huge thanks! :)
 

DeMoN

Member
with lossy compression of the coding.
But pls forget camtasia. This program has more bugs and shortcomings than actual working code :(
 

King Meow

New Member
with lossy compression of the coding.
But pls forget camtasia. This program has more bugs and shortcomings than actual working code :(
Yeah, I'd never use Camtasia for video editing, it's more for noobs and it only supports up to 30fps, lol.
And it can't record over 30fps properly either, so ye. Fuck that :p
But I gotta hand it to them for achieving such awesome quality at a small file size.
 

King Meow

New Member
with lossy compression of the coding.
But pls forget camtasia. This program has more bugs and shortcomings than actual working code :(
Oh, one more thing:
Is it possible to use replay buffer with this setup I'm currently running?
 

wallrik

Member
I read this thread, and I just wanna say, there is something else at play here.

The codec is not the problem. Yes, a codec made for lossless recording may be easier on your processor, but it should be fine with H.264 as well.

I made this clip with the provided screenshot in this thread with qp=0 and YUV444, and it's next to identical to the image, in my opinion.

However, I think you should stick to the UT Video Codec that you tried now. Happy encoding :)
 

King Meow

New Member
I read this thread, and I just wanna say, there is something else at play here.

The codec is not the problem. Yes, a codec made for lossless recording may be easier on your processor, but it should be fine with H.264 as well.

I made this clip with the provided screenshot in this thread with qp=0 and YUV444, and it's next to identical to the image, in my opinion.

However, I think you should stick to the UT Video Codec that you tried now. Happy encoding :)
Thanks for your input and yeah it does look good, but Vegas wouldn't read it as @DeMoN said.
I'll stick with UTVideo and so far I've been able to deal with the file sizes just nice.
I've been taking my clips to vdub and then exporting out using Lagarith lossless as my compressor.
I can't notice any change in how the clip looks after it comes out from vdub and the file size gets reduced by a decent amount (still is very large tho, but w/e :p)
 

cwm9

New Member
Ok, I (think I) finally figured out lossless and OBS. Here's what you have to do:

1) Your base resolution must have an EVEN number of LINES (vertical size) and a horizontal size that is divisible by 8. The NVENC encoder will scale your video for you if this is not the case.
2) BASE and OUTPUT resolution MUST be the SAME or your video will get scaled
3) Under Output/Recording, select:

Encoder: NVENC H.264
Rate control: Lossless
B-frames: 0 <- important

4) Under Advanced, select:

Color Format: I444
YUV Color Space: Read special note below
YUV Color Range: Read special note below

RGB will NOT work, as nvenc will happily perform a lossy conversion to I420 for you before losslessly encoding the result.

Don't forget the B-frames 0. It was the key missing bit for me. Without this, the encoding will be merely *nearly* lossless.

YUV Color Range and Space do not affect "losslessness". However, you might THINK you are having problems if you set this wrong! Neither one is better than the other, they are just different mathematical representations of the same thing. Think of these settings like the difference between Celcius and Fhrenheit, Pounds and Kilograms. If the book says water boils at 100C, don't try to boil it at 100F. You must be sure that whatever you are using to read the file is capable of handling what you set here and that it knows what format you have chosen.

If you wish to use AVISynth, for instance, you might choose 601 as the color space because that's AVISynth's default space. On the other hand, many commercial systems might be expecting 709. AVISynth can be told to use 709, so really you can choose whatever you want. Read your editor/player documentation, or fiddle with it if it has none. I haven't fiddled much with Color Range, but as far as I can deal the same deal holds for that. My apologies, but I don't know which setting is right for AVISynth on that one, so go figure it out for yourself or wait until I know more.

Last note, while testing I set the encoder profile to both high444p and main, and the encoder Level to both auto and 5.1. As far as I can tell these settings don't make any difference, but if you are having problems try high444p and auto.
 
Last edited:

DeMoN

Member
For some reason OBS reacts very strange when using NVEnc and higher than 4:2:0
You get the file in 4:4:4 but in fact it is a 4:2:0 which got bloated up to 4:4:4 with no interpolation - meaning - not just 4:2:0 quality - it is even every 2nd pixel with no color due to no interpolation.

Thats very strange, because NVEnc WOULD be able to encode to 4:4:4. Its a OBS Bug.
 

Osiris

Active Member
I really doubt it's an OBS bug. But I can't really test it personally since my GTX 770 doesn't support high444p.
 

DeMoN

Member
ffmpeg cli can do it right. So I think it is a OBS bug.

edit: Oh and why OBS still cant capture in multiple audio tracks if ffmpeg export is chosen??

ffmpeg can do more than 1 audiotrack - I wonder why OBS doesnt support it there??
And why does it use global_quality command? It is deprecated and always is even written into your obs log by ffmpeg xD
 

cwm9

New Member
Did you try the settings I posted? I get a completely 100% lossless encode with correct color. I know exactly what you are talking about with the color missing, but that only seems to happen wtih some combinations.
 

tsmith

New Member
That fixed the audio and yeah, I'll just deal with the large file size, I guess not everything can be perfect :p
It'll forever remain a mystery to me how Camtasia does this with small file sizes tho, lol.

But once again, huge thanks! :)

The recording component of Camtasia Studio uses a custom-built, highly optimized, lossless codec for low motion video such as those found in desktop screen recordings (e.g. where a mouse cursor is moving around the screen). Of note, the codec doesn't actually record the mouse but rather its position on the screen and which mouse cursor is being displayed at the time (I don't recall how it handles custom cursors like those found in games). It's a nifty abuse of how Windows GDI works where the mouse cursor isn't actually part of the GDI screen buffer but applied much later in the render pipeline (i.e. it's the same reason why pressing Printscreen on the keyboard doesn't include the mouse cursor). The rest of the codec determines which portions of the screen have changed and only stores the minimum required information to recreate the image kind of like animated GIFs but supports storing full RGB colorspace information. The result is a very tiny file for most desktop screen recording sessions.

The TechSmith video codec (TSCC/TSC2) is not designed for recording high motion video. It'll do it, but you'll waste a ton of disk storage in the process.

I've used OBS to record my screen in the past but I'm also looking for something with higher quality (without dropping another $250 on the latest version of Camtasia or trying to upgrade my ancient Camtasia software license to v9). The problem with OBS that I run into is lots of visual artifacts around text much like a JPEG image. If I stay on the same screen for several seconds, the image slowly clears up but it is distracting at times. The other problem is that screen recordings with OBS tend to make whites "gray" when post processing the video. Notably, overlaying images on top of the recorded video shows a stark contrast between actual white and the video. The "white is gray" issue is a problem with OBS + the codecs it uses by default. For my normal screen recording videos where I read a script, I don't really care about the quality loss and OBS is a pretty nice piece of software to get the job done. The current video I'm working on, however, needs to retain color accuracy and so this thread is relevant to me. I tried various settings with OBS mentioned in this thread but everything I tried produced sub-par results OR produced a file that could only be played in VLC but not edited in any of my video editing tools.

CamStudio is the next thing I tried. I've used it before but it's not updated very frequently and is still (many, many years after it launched) a fairly terrible piece of software. A short screen recording of 10 seconds produces a 480MB AVI file but, on the upside, the file was of very good quality. However, after each recording, CamStudio crashes. It's approximately the same awful experience I remember from a decade ago. I'd rather dig out my ancient license of Camtasia Studio than use CamStudio.

Then I ran into this project today:

https://github.com/rdp/screen-capture-recorder-to-video-windows-free

The 10 second recording was a mere 700KB and had very good quality and accurate color reproduction with one very tiny artifact - just two barely noticeable pixels that were off from actual - in the recording I made and could have just been a VLC playback issue. The software requires Java to be installed to use the GUI, which is ridiculous for a 4-button application that mostly just launches ffmpeg. There is a DirectShow filter that is now installed on my system that hopefully won't crash my timelines by just being installed - poorly written DirectShow filters are the worst as they're nearly impossible to debug. It looks like Sony Vegas can't handle the MP4 files that the above program produces but DaVinci Resolve handles them just fine. IMO, this works well enough as an open source free desktop screen recording solution that is on par with the TechSmith codec. Maybe OBS could adopt that codec (or portions of it) into a future release for a dedicated "desktop recording" profile? I'd love to have an all-in-one recording solution that produces files that work everywhere.
 

Fenrir

Forum Admin
The recording component of Camtasia Studio uses a custom-built, highly optimized, lossless codec for low motion video such as those found in desktop screen recordings (e.g. where a mouse cursor is moving around the screen). Of note, the codec doesn't actually record the mouse but rather its position on the screen and which mouse cursor is being displayed at the time (I don't recall how it handles custom cursors like those found in games). It's a nifty abuse of how Windows GDI works where the mouse cursor isn't actually part of the GDI screen buffer but applied much later in the render pipeline (i.e. it's the same reason why pressing Printscreen on the keyboard doesn't include the mouse cursor). The rest of the codec determines which portions of the screen have changed and only stores the minimum required information to recreate the image kind of like animated GIFs but supports storing full RGB colorspace information. The result is a very tiny file for most desktop screen recording sessions.

The TechSmith video codec (TSCC/TSC2) is not designed for recording high motion video. It'll do it, but you'll waste a ton of disk storage in the process.

I've used OBS to record my screen in the past but I'm also looking for something with higher quality (without dropping another $250 on the latest version of Camtasia or trying to upgrade my ancient Camtasia software license to v9). The problem with OBS that I run into is lots of visual artifacts around text much like a JPEG image. If I stay on the same screen for several seconds, the image slowly clears up but it is distracting at times. The other problem is that screen recordings with OBS tend to make whites "gray" when post processing the video. Notably, overlaying images on top of the recorded video shows a stark contrast between actual white and the video. The "white is gray" issue is a problem with OBS + the codecs it uses by default. For my normal screen recording videos where I read a script, I don't really care about the quality loss and OBS is a pretty nice piece of software to get the job done. The current video I'm working on, however, needs to retain color accuracy and so this thread is relevant to me. I tried various settings with OBS mentioned in this thread but everything I tried produced sub-par results OR produced a file that could only be played in VLC but not edited in any of my video editing tools.

CamStudio is the next thing I tried. I've used it before but it's not updated very frequently and is still (many, many years after it launched) a fairly terrible piece of software. A short screen recording of 10 seconds produces a 480MB AVI file but, on the upside, the file was of very good quality. However, after each recording, CamStudio crashes. It's approximately the same awful experience I remember from a decade ago. I'd rather dig out my ancient license of Camtasia Studio than use CamStudio.

Then I ran into this project today:

https://github.com/rdp/screen-capture-recorder-to-video-windows-free

The 10 second recording was a mere 700KB and had very good quality and accurate color reproduction with one very tiny artifact - just two barely noticeable pixels that were off from actual - in the recording I made and could have just been a VLC playback issue. The software requires Java to be installed to use the GUI, which is ridiculous for a 4-button application that mostly just launches ffmpeg. There is a DirectShow filter that is now installed on my system that hopefully won't crash my timelines by just being installed - poorly written DirectShow filters are the worst as they're nearly impossible to debug. It looks like Sony Vegas can't handle the MP4 files that the above program produces but DaVinci Resolve handles them just fine. IMO, this works well enough as an open source free desktop screen recording solution that is on par with the TechSmith codec. Maybe OBS could adopt that codec (or portions of it) into a future release for a dedicated "desktop recording" profile? I'd love to have an all-in-one recording solution that produces files that work everywhere.

Sounds like you found your solution, but chances are the issues you were running into were due to bitrate restrictions which is what would cause the quality loss you experienced with OBS. OBS won't be able to compete with purpose-built desktop recorders for stuff like productivity application recordings, but using rate control options in the encoders (CQP, CRF, etc.) will result in perfectly crisp and good quality video, if not small file size.
 

tsmith

New Member
Yeah, I managed to get a really tiny file from OBS with good quality at one point using tips from this thread and the lossless guide but, unfortunately, the video was not able to be imported into any video editing software that I tried it with. This is mostly a one-off video that I'm working on. The FFmpeg/Java solution is doing just fine for me. I'll most likely go back to my usual and very reliable setup via OBS when I'm done.
 

2L40K

New Member
The recording component of Camtasia Studio uses a custom-built, highly optimized, lossless codec for low motion video such as those found in desktop screen recordings (e.g. where a mouse cursor is moving around the screen).

The recording component of Camtasia Studio does NOT record a video at all. It produces a TREC or CAMREC file, which is not a video.

The "custom-built, highly optimized, lossless codec", namely TechSmith Screen Capture Codec (TSCC) or the TechSmith Screen Codec v2 (TSC2), which comes with version 8 and later, can be used when you export a video. But you can use other codecs as well.

To summarize:
  • You can't play TREC or CAMREC file in a video player, and you can't convert it to a video without Camtasia.
  • Exported videos encoded by Camtasia with TSCC or TSC2 can be played in a video player if you install the corresponding codec on your system.
  • TechSmith provides for free only the decoding parts of TSCC and TSC2.
  • Full (encoding and decoding) versions of TSCC or TSC2 are installed only with Camtasia.
  • In theory you can encode with TSCC or TSC2 from inside other applications if you have Camtasia installed.
  • In practice sometimes there are problems and I have never tried that.

Of note, the codec doesn't actually record the mouse but rather its position on the screen and which mouse cursor is being displayed at the time (I don't recall how it handles custom cursors like those found in games). It's a nifty abuse of how Windows GDI works where the mouse cursor isn't actually part of the GDI screen buffer but applied much later in the render pipeline (i.e. it's the same reason why pressing Printscreen on the keyboard doesn't include the mouse cursor). The rest of the codec determines which portions of the screen have changed and only stores the minimum required information to recreate the image kind of like animated GIFs but supports storing full RGB colorspace information. The result is a very tiny file for most desktop screen recording sessions.

It's not like GIFs, but more like SWF (Shockwave Flash).
And what you explain here is NOT the GDI method of capture, but the one that is called "Mirror driver" or a "Video Hook Driver (VHD)".

Wikipedia said:
When video mirroring is active, each time the system draws to the primary video device at a location inside the mirrored area, a copy of the draw operation is executed on the mirrored video device in real-time.

BB Flash Back used to use this method back in the time of Windows XP. And this was really an extremely high performance method of capture. It was able to capture 720p on Pentium II with almost zero CPU load! Of course, it was not able to capture video playback or gameplay - black rectangles appeared in their places.

Here is some explanation from the online help of BB Flash Back:
About Record Modes

Not very detailed, but it gives some idea of the different capture modes. I was not able to find anything that gives more detail.

If we use the terminology of the BB Flash Back help file, than:
  • Camtasia probably uses GDI mode,
  • but OBS probably uses MPEG mode.
  • Camtasia never had a Capture driver mode,
  • but the BB Flash Back's capture driver is not usable on Windws 7 and later, because requirements changed and i was not updated
  • Capture drivers still exist, example is "RDPDD Chained DD", which is used in Remote Desktop.
  • I never tested how it goes performance wise...

I've used OBS to record my screen in the past but I'm also looking for something with higher quality (without dropping another $250 on the latest version of Camtasia or trying to upgrade my ancient Camtasia software license to v9). The problem with OBS that I run into is lots of visual artifacts around text much like a JPEG image. If I stay on the same screen for several seconds, the image slowly clears up but it is distracting at times. The other problem is that screen recordings with OBS tend to make whites "gray" when post processing the video. Notably, overlaying images on top of the recorded video shows a stark contrast between actual white and the video. The "white is gray" issue is a problem with OBS + the codecs it uses by default.

So next, here come the codes.
H.264 lossless is not the only lossless codec, some examples:
  • Zip Motion Block Video (ZMBV) known also as DosBox Capture Codec.
  • MSU Screen Capture Lossless Codec
ZMBV is compatible with ffmpeg (both encoding and decoding), and it's also compatible with YouTube.
But it uses PAL8 colorspace, which is a limitation.

MSU Screen Capture Lossless Codec is incompatible with ffmpeg and YouTube, but supports RGB32, RGB24 and RGB16.

There are other codecs with different limitations...
 

DeMoN

Member
which is not a video
It is. Obviously. Or where do you think it is stored? :D
You can't play TREC or CAMREC file in a video player, and you can't convert it to a video without Camtasia
You can. rename the camrec extension to zip and you can open it with a zip tool like winrar and export the video and audio from it.

Thats why you have to "save" a recorded capture by camtasia.
They're so stupid like still many further timeline programs, which apparently assume that avi can only handle one audio track and not multiple and due to this they allow multitrack audio capture only with this nonsense renamed zip container way. incompetency at work.
 
Top