<p>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</p>
<p>I record videos at 1080P this way :</p>
<pre><code>ffmpeg \
-f x11grab \
-framerate 60 \
-video_size &quot;1920x1080&quot; \
-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 \
</code></pre>
<p>My upscale ffmpeg command ( produces laggy videos )</p>
<pre><code>ffmpeg -i output.mp4 -vf scale=-1:2160:flags=lanczos -c:v libx264 -crf 21 -framerate 60 out.mp4
</code></pre>
<p>How do I export the video in 2k or 4k without the lag?</p>

CC BY-SA 4.0
2022-07-28T07:43:50.690Z
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
CC BY-SA 4.0
2022-07-29T11:31:46.233Z
when youtube uses AVC then my video's color quality gets reduced :/
siduck
CC BY-SA 4.0
2022-07-29T11:37:04.457Z
That's likely more to do with your profiling than YouTube itself. See my comment on your other question.
Tetsujin
CC BY-SA 4.0
2022-07-29T12:02:55.757Z
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
CC BY-SA 4.0
2022-07-30T05:47:50.643Z
'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
CC BY-SA 4.0
2022-07-30T05:47:55.533Z
See https://www.richardlackey.com/choosing-video-color-space/ which doesn't actually cover what happens with YouTube specifically, though it does mention the lightening effect.
Tetsujin
<ffmpeg><video><encoding><video-quality><decoding>
Export a video to 4k or 2k with FFMPEG and without lag (UPSCALE VIDEO)
siduck
# Export a video to 4k or 2k with FFMPEG and without lag (UPSCALE VIDEO)

(Asked by: username_0 on 2022-07-27)

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?

**Tags:** ffmpeg, video, encoding, video-quality, decoding

> **Comments:**
> **username_1**: 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.  
> **username_0**: when youtube uses AVC then my video's color quality gets reduced :/  
> **username_1**: That's likely more to do with your profiling than YouTube itself. See my comment on your other question.  
> **username_0**: 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  
> **username_1**: '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.  
> **username_1**: See https://www.richardlackey.com/choosing-video-color-space/ which doesn't actually cover what happens with YouTube specifically, though it does mention the lightening effect.  

---

## 0 answers

