Answers.Body: <p>After some more back-and-forth with Bing, it seems <code>zscale</code> works far better than <code>scale</code>.</p>
  <p><code>ffmpeg -i 1080.png -vf &quot;zscale=-1:360:filter=point&quot; 360.png</code></p>
  <p>With video, add <code>format=pix_fmts=rgb24,</code> to the start of the <code>vf</code> chain.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-31T23:11:03.363Z
Answers.LastActivityDate: 2023-03-31T23:11:03.363Z
Answers.UserDisplayName: spacer GIF
Answers.Body: <p>It also seems that <code>full_chroma_inp</code> works with <code>scale</code>. Another option in case <code>zscale</code> isn't available.</p>
  <p><code>ffmpeg -i 1080.png -vf scale=-1:360:flags=neighbor+full_chroma_inp 360.png</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-31T23:29:00.527Z
Answers.LastActivityDate: 2023-03-31T23:29:00.527Z
Answers.UserDisplayName: spacer GIF
Body: <p>I'm trying to downscale a video with nearest-neighbour scaling, but the results are very poor.</p>
  <p>To try and get to the bottom of it, I created <a href="https://i.sstatic.net/yeLkN.png" rel="nofollow noreferrer">this image</a> which is a repeating pattern of various colours. The expected result is that the output image, when downscaled from 1080p to 360p, is solid green (#00ff00). Or possibly red, if it samples from the top-left instead of the centre.</p>
  <p>Instead, the resulting image is green with vertical bars of #25e525 and #44c383, neither of which are present anywhere in the original image.</p>
  <p><a href="https://i.sstatic.net/EoGt4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EoGt4.png" alt="" /></a></p>
  <p>I've applied various other things to my command, as seen below, but it makes no difference.</p>
  <p><code>ffmpeg -i 1080.png -vf scale=-1:360:flags=neighbor+accurate_rnd:sws_dither=none -pix_fmt rgb24 360.png</code></p>
  <p>Upscaling works fine - it's just downscaling that goes wrong. Any ideas?</p>
  
Tags: <ffmpeg>
Title: ffmpeg nearest-neighbor downscale not working as expected
UserDisplayName: spacer GIF
ThreadText: # ffmpeg nearest-neighbor downscale not working as expected
  
  (Asked by: username_0 on 2023-03-31)
  
  I'm trying to downscale a video with nearest-neighbour scaling, but the results are very poor.
  
  To try and get to the bottom of it, I created [this image](https://i.sstatic.net/yeLkN.png) which is a repeating pattern of various colours. The expected result is that the output image, when downscaled from 1080p to 360p, is solid green (#00ff00). Or possibly red, if it samples from the top-left instead of the centre.
  
  Instead, the resulting image is green with vertical bars of #25e525 and #44c383, neither of which are present anywhere in the original image.
  
  [![](https://i.sstatic.net/EoGt4.png)](https://i.sstatic.net/EoGt4.png)
  
  I've applied various other things to my command, as seen below, but it makes no difference.
  
  `ffmpeg -i 1080.png -vf scale=-1:360:flags=neighbor+accurate_rnd:sws_dither=none -pix_fmt rgb24 360.png`
  
  Upscaling works fine - it's just downscaling that goes wrong. Any ideas?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2023-03-31. Score: 0
  
  After some more back-and-forth with Bing, it seems `zscale` works far better than `scale`.
  
  `ffmpeg -i 1080.png -vf "zscale=-1:360:filter=point" 360.png`
  
  With video, add `format=pix_fmts=rgb24,` to the start of the `vf` chain.
  
  
  ---
  
  ### Answer by username_0 on 2023-03-31. Score: 0
  
  It also seems that `full_chroma_inp` works with `scale`. Another option in case `zscale` isn't available.
  
  `ffmpeg -i 1080.png -vf scale=-1:360:flags=neighbor+full_chroma_inp 360.png`
  
  
  ---
  
  