<p>YouTube re-encodes whatever you give it. The process is lossy so there will be a quality reduction. All you can do is give it a very high quality:</p>

<pre><code>ffmpeg -framerate 10 -pattern_type glob -i 'resized/*.JPG' -vf scale=1280:-2 -c:v libx264 -crf 17 out.mp4
</code></pre>

<ul>
<li><p>Use <code>-crf 17</code> or <code>-crf 18</code> for higher quality.</p></li>
<li><p>Try without <code>-pix_fmt yuv420p</code>. I'm not sure what YouTube uses for pixel format conversion, but perhaps it will look better than the FFmpeg swscale if they are using something different.</p></li>
<li><p>No need for <code>-profile:v high</code>. Let the encoder choose. You usually only need to set a profile when your target device is limited in profile support.</p></li>
</ul>

CC BY-SA 4.0
2019-11-14T19:52:47.170Z
Great, thanks I will give it a shot.
Aydin Hassan
CC BY-SA 4.0
2019-11-15T12:18:27.193Z
Wouldn't 4:2:2 be a better option?
stib
CC BY-SA 4.0
2019-11-23T21:37:58.320Z
@stib It is unknown if the OP additionally wanted to play the output in non-FFmpeg based players. Also, the JPG input pixel formats may be 4:4:4, so choosing 4:2:2 would not be ideal in that case if a user wanted to let ffmpeg automatically choose the "best" pixel format (yuvj444p in this case) and make YouTube do the conversion.
llogan
CC BY-SA 4.0
2019-11-25T00:49:32.970Z
Of course. I realise I misread "try without" and thought you'd suggested "try with".
stib
CC BY-SA 4.0
2019-11-14T18:42:10.257Z
2019-11-14T18:42:10.257Z
llogan
<p>I created a video from a bunch of images off my camera using FFMPEG. I set it to 10fps. The output video looks fine. As soon as I upload it to Facebook or Youtube the quality is reduced significantly.</p>

<p>Here is the command I used to create the video:</p>

<p><code>ffmpeg -framerate 10 -pattern_type glob -i 'resized/*.JPG' -s:v 1280x720 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p  out.mp4</code></p>

<p>Each image has been resized to 1000x1500 pixels.</p>

<p>Screenshot from video from ffmpeg: <a href="https://www.dropbox.com/s/r3v30lj15a5hl6a/local.png?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/r3v30lj15a5hl6a/local.png?dl=0</a>
Screenshot from video from Youtube: <a href="https://www.dropbox.com/s/qrur54r7xsnnrxs/youtube.png?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/qrur54r7xsnnrxs/youtube.png?dl=0</a></p>

<p>If you look carefully you can see the Youtube one is missing a lot of sharpness and detail. It looks much worse when playing through the video.</p>

<p>FYI - I know nothing about video encoding, I just googled for the ffmpeg command so most likely I am doing something silly.</p>

<p>Thank you!</p>

<ffmpeg><video-quality><youtube>
How to avoid quality loss on yotube/fb when encoding images into video via FFMPEG
Aydin Hassan
# How to avoid quality loss on yotube/fb when encoding images into video via FFMPEG

(Asked by: username_0 on 2019-11-14)

I created a video from a bunch of images off my camera using FFMPEG. I set it to 10fps. The output video looks fine. As soon as I upload it to Facebook or Youtube the quality is reduced significantly.

Here is the command I used to create the video:

`ffmpeg -framerate 10 -pattern_type glob -i 'resized/*.JPG' -s:v 1280x720 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p out.mp4`

Each image has been resized to 1000x1500 pixels.

Screenshot from video from ffmpeg: <https://www.dropbox.com/s/r3v30lj15a5hl6a/local.png?dl=0>
Screenshot from video from Youtube: <https://www.dropbox.com/s/qrur54r7xsnnrxs/youtube.png?dl=0>

If you look carefully you can see the Youtube one is missing a lot of sharpness and detail. It looks much worse when playing through the video.

FYI - I know nothing about video encoding, I just googled for the ffmpeg command so most likely I am doing something silly.

Thank you!

**Tags:** ffmpeg, video-quality, youtube


---

## 1 answers

### Answer by username_1 on 2019-11-14. Score: 1 | Accepted answer

YouTube re-encodes whatever you give it. The process is lossy so there will be a quality reduction. All you can do is give it a very high quality:
ffmpeg -framerate 10 -pattern_type glob -i 'resized/*.JPG' -vf scale=1280:-2 -c:v libx264 -crf 17 out.mp4


Use -crf 17 or -crf 18 for higher quality.
Try without -pix_fmt yuv420p. I'm not sure what YouTube uses for pixel format conversion, but perhaps it will look better than the FFmpeg swscale if they are using something different.
No need for -profile:v high. Let the encoder choose. You usually only need to set a profile when your target device is limited in profile support.

> **Comments:**
> **username_0**: Great, thanks I will give it a shot.  
> **username_2**: Wouldn't 4:2:2 be a better option?  
> **username_1**: @username_2 It is unknown if the OP additionally wanted to play the output in non-FFmpeg based players. Also, the JPG input pixel formats may be 4:4:4, so choosing 4:2:2 would not be ideal in that case if a user wanted to let ffmpeg automatically choose the "best" pixel format (yuvj444p in this case) and make YouTube do the conversion.  
> **username_2**: Of course. I realise I misread "try without" and thought you'd suggested "try with".  

---

