Post subject: GB/GBC/GBA Encoding
TiKevin83
He/Him
Ambassador, Moderator, Player, Site Developer (119)
Joined: 3/17/2018
Posts: 348
Location: Holland, MI
I have some suggestions for GB/GBC/GBA encoding based on experience in making this set of 4k encodes for YT from Console capture, with the captures being 1:1 with emulator the same ideas should apply. https://www.youtube.com/watch?v=Oo6HcU0iP4c&list=PLH-rsHQS9LqjDJCGTuLF7YM_FrcsTW9qz Even Integer Scales for Color First and most importantly for quality, I've been sticking to even integer multiples when scaling. YT doesn't have full resolution color, they do 4:2:0, so 15x causes the color to blur at the transitions between original pixels. Then 15x at 4k is 7.5x at 1080 and 5x at 720, so the lower resolutions are also affected. 12x at 4k goes to 6x at 1080 and 4x at 720, so no harm from 4:2:0 at those resolutions. The 360p30 size is also a 2x scale with this setting so it's only impacted by the framerate loss and not color blur. Some might prefer the picture to fit the full screen, IDK I prefer avoiding blur and letterboxing the empty space. Applications for lossless video Now also I was talking with Spikestuff about whether to use lossless or a high quality CRF between 7 and 14. When doing these extreme integer multiple scales of pixel art games, the differences between lossless and lossy aren't as dramatic, and the output size is mostly affected by audio and not video. At only a 4x scale to 720p, my quad core machine did a lossy pass of Yellow NSC at 410fps and lossless at 355fps, with the output size being 14MB for lossy and 50MB for lossless (video only). At a 12x scale for 4k the same machine does 56fps for lossy and 40fps for lossless, 148MB and 191MB. This is for 12 minutes of video: lossless 4k footage of 12x integer scale GBC is only ~1GB/hour. It seems in this weird use case, lossless is not actually substantially worse than lossy for filesize or encode speed. The filesize is still 3x worse at 720 with a 4x scale, but 100MB and 300MB an hour are both very small for video (lossless audio would be larger). This is the ffmpeg line I used to do the upscales for YT along these guidelines. The GB/GBC footage was already letterboxed to 240x160, which worked fine with them both having the same 12x limitation at 4k. ffmpeg -i input.avi -vf scale=2880x1920:flags=neighbor,pad=3840:2160:(ow-iw)/2:(oh-ih)/2 -c:v libx264 -crf 0 -c:a copy -pix_fmt yuv444p output.mkv
Cyorter
He/Him
Editor, Player (236)
Joined: 2/8/2017
Posts: 138
Location: Venezuela
What I see kinda strange is that you use no quantization and encode using yuv colors...
TiKevin83
He/Him
Ambassador, Moderator, Player, Site Developer (119)
Joined: 3/17/2018
Posts: 348
Location: Holland, MI
All h.264 is YCbCr internally anyway, YUV444 just signals to keep that encode 444 and let YT handle going down to 420. CRF 0 is the same as QP 0 (both lossless, no quantization). CRF and QP do similar things in lossy modes, CRF sets a target QP and the encoder fluctuates around it instead of being stuck to that exact QP.
Site Admin, Skilled player (1234)
Joined: 4/17/2010
Posts: 11251
Location: RU
We discussed most of it here: Thread #19426: Best aspect ratio correction for HD I removed the pictures I posted there from tasvideos server, they're all available here now: https://yadi.sk/d/_efr6i_fK5x9JA
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.