Posts for slither


slither
He/Him
Experienced Forum User, Published Author, Player (25)
Joined: 12/27/2020
Posts: 3
Aktan wrote:
Interesting, but how did you do the pixel stretching method? Please post your script. The reason why we don't use the flag is control. If we stretch it ourselves before sending to YT, we have control on how the stretch would take place. It's because we did the stretch already that causes the filesize to increase. This is a given. Depending on how YT does the stretch, it could end up with a smaller file size than how we do it, since the method we stretch is suppose to be an higher quality stretch.
I posted the ffmpeg commands used in the test, I simply did a nearest neighbor scale to the intended resolution. I think testing a stretch directy to 5974x4480 should be tried as well, as this scales the height by an integer.
slither
He/Him
Experienced Forum User, Published Author, Player (25)
Joined: 12/27/2020
Posts: 3
Forgot to post links to the videos. Setting DAR: https://www.youtube.com/watch?v=VHCIp5kPn4s Pixel Stretching: https://www.youtube.com/watch?v=WD2uE6lA2RI
Post subject: Setting the DAR versus pixel stretching for YouTube encodes
slither
He/Him
Experienced Forum User, Published Author, Player (25)
Joined: 12/27/2020
Posts: 3
Most, if not all high definition encodes with aspect ratio correction on YouTube currently stretch the pixels, and I have conducted a test with FFmpeg to see whether setting the DAR produces better results. Both video clips are exactly 10 seconds in length. The FFmpeg commands used are as follows: For setting the DAR, ffmpeg -i input.avi -c:v libx264 -crf 18 -c:a copy -pix_fmt yuv420p -s 5120x4480 -sws_flags neighbor -aspect 4:3 dar.mkv For pixel stretching, ffmpeg -i input.avi -c:v libx264 -crf 18 -c:a copy -pix_fmt yuv420p -s 5760x4320 -sws_flags neighbor stretching.mkv Immediately after encoding, the filesize difference is apparent. The video with the DAR set was 3 014 432 bytes, while the one that stretched the pixels was 6 194 974 bytes. This is due to H.264's block-based encoding. After uploading it to YouTube and letting it process, what I have noticed is that both videos have been reencoded to VP9 + Opus from the initial output, which was H264 + PCM, and the video which set the DAR was reencoded to 5704x4480. After using ytdlp to download those files, the file with the DAR set (6 802 718 bytes) was still smaller than the one with the pixels stretched (7 063 149 bytes), even though it was resized. The reencoded videos were still in the YUV420 colourspace. Quality-wise, setting the DAR is much better before YouTube's reencode due to chroma subsampling, however after the reencode the gap is narrowed much more, with the pixel-stretched video having only small artifacts due to nearest-neighbor scaling by a non-integer factor. In conclusion, due to the much smaller filesize and negligible quality loss after YouTube's reencode, I would prefer setting the DAR over pixel stretching.