[FFmpeg-devel] Controlling sws dithering.

Steinar Apalnes steipal at gmail.com
Wed Jul 7 14:44:29 EEST 2021


Hi,

I tried posting a similar question to the ffmpeg user list but got no
response. So I'm trying my luck here now. The thing is I need to be able to
control how the sws dither behaves.
Using a build from master (26.06.2021) I would expect to see different
frame hash on the these two commands:

ffmpeg -f lavfi -i mandelbrot -vf scale=sws_dither=none,format=rgb4_byte
-vframes 1 -f framehash -
ffmpeg -f lavfi -i mandelbrot -vf scale=sws_dither=ed,format=rgb4_byte
-vframes 1 -f framehash -

But they are identical:
b1c1ff5ea2221c0d0afaa86dec593491fd85fa2d5f5a377ff9c2e6c3ab5be5bb
Also, the following variations creates the same results.

ffmpeg -f lavfi -i mandelbrot -sws_dither none -pix_fmt rgb4_byte -vframes
1 -f framehash -
ffmpeg -f lavfi -i mandelbrot -sws_dither ed -pix_fmt rgb4_byte -vframes 1
-f framehash -

Does anyone have a clue on what I might be doing wrong or is the sws dither
control simply broken?

Raw FFmpeg output:
ffmpeg version N-100854-g85f49e8607 Copyright (c) 2000-2021 the FFmpeg
developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
  configuration:  --disable-static --enable-shared --pkg-config=pkgconf
--cc='ccache gcc' --cxx='ccache g++' --disable-autodetect --enable-amf
--enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2
--enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2
--enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265
--enable-libdav1d --enable-libaom --disable-debug --enable-fontconfig
--enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx
--enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-amrwbenc --enable-libwebp --enable-libxml2 --enable-libzimg
--enable-libshine --enable-gpl --enable-avisynth --enable-libxvid
--enable-libopenmpt --enable-version3 --enable-libsrt --enable-libgsm
--enable-libvmaf --enable-libsvtav1 --enable-mbedtls
--extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++
--extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads
--shlibdir=/local64/bin-video
  libavutil      56. 64.100 / 56. 64.100
  libavcodec     58.119.100 / 58.119.100
  libavformat    58. 65.101 / 58. 65.101
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7.100.100 /  7.100.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, lavfi, from 'mandelbrot':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[0] / 0x424752), rgb0, 640x480 [SAR
1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
#format: frame checksums
#version: 2
#hash: SHA256
#software: Lavf58.65.101
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 640x480
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
Output #0, framehash, to 'pipe:':
  Metadata:
    encoder         : Lavf58.65.101
    Stream #0:0: Video: rawvideo (B4BY / 0x59423442), rgb4_byte(pc,
progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 30720 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.119.100 rawvideo
0,          0,          0,        1,   307200,
b1c1ff5ea2221c0d0afaa86dec593491fd85fa2d5f5a377ff9c2e6c3ab5be5bb
frame=    1 fps=0.0 q=-0.0 Lsize=       0kB time=00:00:00.04 bitrate=
 66.0kbits/s speed=1.21x
video:300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown


PS: I supplied output from only one of the command lines cause they all
produced the same output.

-steinar


More information about the ffmpeg-devel mailing list