News:

--

Main Menu

Lossless encoding, widely varying bitrates

Started by Captainday, February 21, 2023, 10:31:51 PM

Previous topic - Next topic

Captainday

I have a video I upscaled with video2x using
E:\video2x-4.8.1-win32-full\dependencies\ffmpeg\bin\ffmpeg -r 23.976023976023978 -hwaccel auto -y -f image2 -i E:\video2x-4.8.1-win32-full\New folder\tmpdp3a7k0s\extracted_%d.png -vcodec libx264 -pix_fmt yuv420p -crf 0 -vf pad=ceil(iw/2)*2:ceil(ih/2)*2 -tune animation

The output was 3840x2144, because the source was 1072 height. I used CRF 0 animation tune and the 3:13 video came out with 134.5Mb/s bitrate.

I opened it in avidemux and used swsresize lanczos to make it 3840x2160, and used Mplayer Hue -10.00 2

The funny business happened when I saved it with Nvidia H264; am I wrong thinking that its supposed to be lossless when I change rate control from 'controlled by preset' to 'constant quantizer' 0?

Nvidia H264 Profile High
CQ 0, GOP size 100, Max B-frames 2, B Frames as Ref Middle, Max Ref Frames 3, Lookahead 24

Spit out a video with 105.9Mb/s bitrate. It went from 3.03 GB to 2.38 GB.

I changed the preset from 'High Quality' to 'Lossless' and it went to 4.39 GB and 195.4Mb/s bitrate which also didn't seem right

I switched to x264 and used medium preset, high profile, animation tuning, CRF 0 and it gave me 3.32 GB 147.7Mb/s

Raw Upscale x264 CRF 0: 3.03 GB 134.5 Mb/s
x264 medium CRF 0 + Filters: 3.32 GB 147.7 Mb/s
H264 High Quality CQ 0+ Filters: 2.38 GB 105.9 Mb/s
H264 Lossless CQ 0 + Filters: 4.39 GB 195.4 Mb/s

I took screencaps at the same frame, with movement, zoomed in and went back and forth between the photos and I cannot find a single pixel difference... Is it a difference in efficiency or is something being thrown out?
I thought it might be how I setup B-frames, but setting Max b-frames to 0 and b-frame reference made the file size/bitrate drop another 2%. I wish to upload to youtube which will re-encode it again, but I don't understand how changing the preset to lossless doubles the file size when it is CQ 0. My only guess that makes any sense is maybe the color is 4 2 2 instead of 4 2 0 and that's why its almost double and unnecessary?