how do I upscale a video to 4k or 2k with ffmpeg? youtube encodes the videos which results in some quality loss of the video. So to make youtube use VP09 encoder on my videos, I have to export the video in 2k or 4k

I record videos at 1080P this way :

ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "1920x1080" \
-i :1 \
-f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 \
-vf setpts=N/FR/TB \
-c:v libx264rgb -crf 0 -preset ultrafast -color_range 2 \
output.mp4 \

My upscale ffmpeg command ( produces laggy videos )

ffmpeg -i output.mp4 -vf scale=-1:2160:flags=lanczos -c:v libx264 -crf 21 -framerate 60 out.mp4

How do I export the video in 2k or 4k without the lag?

  • I'm not sure why people go to all this trouble to avoid AVC/H264. If you get that right in the first place it looks absolutely fine. I don't see the benefit of artificially upscaling to try get VP09, the 1080 will still be h264.
    – Tetsujin
    Jul 28, 2022 at 7:43
  • when youtube uses AVC then my video's color quality gets reduced :/
    – siduck
    Jul 29, 2022 at 11:31
  • That's likely more to do with your profiling than YouTube itself. See my comment on your other question.
    – Tetsujin
    Jul 29, 2022 at 11:37
  • no its not, my video looks fine locally ( accurate colors ) but when I upload it on youtube, youtube compresses it. youtube uses AVC for small channels and mine is a small channel so it used AVC which resulted in reduced quality colors
    – siduck
    Jul 29, 2022 at 12:02
  • 'Fine locally' is not an accurate methodology. Is your display calibrated? If so, what is it calibrated to, sRGB, Rec709…? If not, then you have no idea what you are uploading, only that it responds differently once it's on YouTube, which implies you are calibrated to [or approximated to] sRGB, as I said on the other thread. You always have to pre-empt Rec709 on sRGB, as the gamut is approximately the same, but the 'gamma' (transfer function/white point) is not.
    – Tetsujin
    Jul 30, 2022 at 5:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.