vkohaupt / vokoscreenNG

vokoscreenNG is a powerful screencast creator in many languages to record the screen, an area or a window (Linux only). Recording of audio from multiple sources is supported. With the built-in camera support, you can make your video more personal. Other tools such as systray, magnifying glass, countdown, timer, Showclick and Halo support will help
https://linuxecke.volkoh.de/vokoscreen/vokoscreen.html
GNU General Public License v2.0
1.05k stars 91 forks source link

A percentage based encoder #305

Open Templayer opened 4 months ago

Templayer commented 4 months ago

Any chance of a percentage-based quality encoding in Linux?

Example in Bandicam with MPEG1 (under WinXP) set at 100% quality - while recording Jagged Alliance 2: 10-minute parts are about 400MB. If there is rain, then the file size might go up to and beyond 4000MB (yes, that one additional zero is intentional...), because the codec is unable to compress it without losing visual acuity, thus storing it raw instead. And that is something I want.

Maybe a non-Intel MPEG2 could be used for that? https://gstreamer.freedesktop.org/documentation/mpeg2enc/index.html?gi-language=c

I'll switch to my Windows desktop and printscreen what I mean...

...here we go:

Mirillis Action while set to AVI will output FICV by default, with quality indistinguishable from when it was recorded -

image

Bandicam can use the NVENC (yes, I know NVENC is hardware-based...) version of H.264 and enables the user to set a quality as a percentage:

image

image

With a variable bitrate:

image

vkohaupt commented 3 weeks ago

It's been three months, but I've had a chance to look into it now. You can record losslessly using the following settings, see image. Is that what you're looking for?

vokoscreenNG-2024-06-14_19-10-57 770

Templayer commented 3 weeks ago

It's been three months, but I've had a chance to look into it now. You can record losslessly using the following settings, see image. Is that what you're looking for?

vokoscreenNG-2024-06-14_19-10-57 770

No.

I am not looking for lossless encoding but for visually lossless encoding. The difference in file size is huge.

At least that is if I remember what h264/x264 do when set to 0 - does it just not compress anything? That is what I assume. I have never tried that.

Let's take MPEG1 as an example. You can set it to 100% quality. Does it mean lossless? No, the videos can be tiny. It just means that it will raise or lower the bitrate dynamically to make sure that it is visually indistinguishable from the original. It is possible to record 1 hour of video into 1GB of 100% quality by using MPEG1 and a game that is for example 2D and runs in 800x600. MPEG1, however, hits ceilings above certain thresholds (1028+ pixels vertically) which causes it not to record at 59.94FPS while eating a lot of resources. It is perfect for old games, but not usable for newer ones or upscaled ones.

Compared to MPEG1, FICV produces bigger video files but uses fewer resources.

NVENC H264 set to 100% quality (which is not the quality rate slider I assume) produces humongous files sometimes (it really hates when I move the screen around in Fallout Tactics, which causes 20 minutes to become 20GB), but uses next to no system resources because it is a hardware encoder located on the GPU.

If you try to make uncompressed footage from a game in 800x600, then an hour probably won't be 1GB. ;)

I do not have multi-TB recording SSDs that I am willing to kill by constantly rewriting them by recording onto them.

But of course, I might be talking out of my arse here, it is REALLY hard to find documentation for what those fields in these applications mean.

I just even scoured the manual: https://mirillis.com/pdf/user-manual/Action!-Game-and-screen-recorder-manual.pdf and found no mention of what it really is or how it works exactly. Argh.

vkohaupt commented 2 weeks ago

No.

I am not looking for lossless encoding but for visually lossless encoding. The difference in file size is huge.

This is visually lossless, raw is factor ~10 higher. Raw: 1920x1080, 60fps, 24 bit color, 60 sec. --> ~20GB filesize

NVENC H264 set to 100% quality (which is not the quality rate slider I assume) produces humongous files sometimes (it really hates when I move the screen around in Fallout Tactics, which causes 20 minutes to become 20GB), but uses next to no system resources because it is a hardware encoder located on the GPU.

The changed pixels have to be saved somewhere. The more movement on the screen, the larger the file.

Try out the x264 settings until you find the right ones for you.

Templayer commented 2 weeks ago

No. I am not looking for lossless encoding but for visually lossless encoding. The difference in file size is huge.

This is visually lossless, raw is factor ~10 higher. Raw: 1920x1080, 60fps, 24 bit color, 60 sec. --> ~20GB filesize

NVENC H264 set to 100% quality (which is not the quality rate slider I assume) produces humongous files sometimes (it really hates when I move the screen around in Fallout Tactics, which causes 20 minutes to become 20GB), but uses next to no system resources because it is a hardware encoder located on the GPU.

The changed pixels have to be saved somewhere. The more movement on the screen, the larger the file.

Try out the x264 settings until you find the right ones for you.

1920x1080, 60fps, 24 bit color, 60 sec. --> ~20GB filesize

V

1920x1080, 60fps, 24 bit color, 60 MINUTES. --> ~50 MB filesize

...if recording a digital tabletop game. :) (Sázky a Dostihy, to be more precise)

My recording SSD is 100GB. I need to be able to store HOURS of footage per session ON THAT DRIVE. Visually losslessly, NOT losslessly, because that obviously wouldn't fit. I have recorded over five THOUSAND videos like that, using the VISUALLY lossless ("100%") setting.

Over 5 thousand has to be a lie, right?

image

Nope.

"Try out the x264 settings until you find the right ones for you."

But that is going to take a lot of time if I have to finnick with it for each game until I find a quality factor that does it visually losslessly. With "100%", this is sorted for me, as the size only blops up if it finds frames that cannot be compressed without losing quality, thus those specific frames get stored losslessly.

We could go ask Bandicam how exactly does the 100% setting work for x264 / NVENC h264.

vkohaupt commented 2 weeks ago

We could go ask Bandicam how exactly does the 100% setting work for x264 / NVENC h264.

That would be nice of you. Preferably as soon as possible so I can install it.

Templayer commented 2 weeks ago

We could go ask Bandicam how exactly does the 100% setting work for x264 / NVENC h264.

That would be nice of you. Preferably as soon as possible so I can install it.

I've written a rather large email to them, asking them to clarify the mapping and implementation of the Quality field for the MPEG1 codec and the NVENC+CPU-based h264 codecs. Let's see what their response is going to be.

Templayer commented 2 weeks ago

We could go ask Bandicam how exactly does the 100% setting work for x264 / NVENC h264.

That would be nice of you. Preferably as soon as possible so I can install it.

I've written a rather large email to them, asking them to clarify the mapping and implementation of the Quality field for the MPEG1 codec and the NVENC+CPU-based h264 codecs. Let's see what their response is going to be.

This is the response that came back:

If you check VBR, set the quality value to 80, and record your PC screen for 10 seconds, you may get a 4MB file. If you check VBR, set the quality value to 100, and record your PC screen for 10 seconds, you may get a 10MB file.

I'm sick and tired of trying to explain everything to everyone and failing at it miserably. At no point have I asked how much MB is that going to take. This was my original email that this was replying to:

Hello!

There is a question that I would really appreciate if you could answer it.

In Bandicam, there is a quality percentage setting that I always set to 100%.

image image

(and yes, that is how your setting windows look like under my system theme - if the images didn't get inlined, they should still be in the attachments)

My question is - how exactly does that work? To be precise - how does the quality field work for the MPEG1 codec, and how does that work for NVENC or CPU-based h264?

What would be the (even rough) equivalent of compression settings for these two codecs in FFMPEG? (for the 100% quality setting)

For h264 in other applications, I can usually set up a quality factor on a slider. Do various percentage values in Bandicam equal various values on those sliders? If not, then what does it do? If yes, then what is the math/value mapping? Does 100% mean 0 quality RF (i.e. uncompressed? That sounds wrong...)? 1 QRF? 5 QRF?

After some googling, I was unable to get a detailed explanation. Maybe this should be added somewhere? Unless I failed to find it, of course.

While I do most of my gaming on Win7, I'm slowly looking towards recording games under Linux Mint, and I am attempting to get the same exact settings, so that I may keep doing what I do as I am used to. I'll keep using your software for older games, especially those that run on Directx versions that are lower than Directx 8. :p

Thank you for reading all of this, Templayer