Opened 11 years ago

Last modified 21 months ago

#4614 open enhancement

swscale YUV 10bpc (10-bit per component) -> 8bpc, user controlled dithering

Reported by: surfdog2020 Owned by:
Priority: wish Component: swscale
Version: git-master Keywords: dithering
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
providing arguments into 'sws_dither' never affects the output. It appears that no matter which dithering algorithm you specify in sws_dither (of the 4 that are available), ffmpeg ignores it and uses the same dithering algorithm for colorspace conversion no matter what. MD5s of the output .yuv files confirms this.

How to reproduce:

commands only :
./ffmpeg -v debug -y -i /mnt/storage/ProRes_10bit_422.mov -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=a_dither mnt/storage/raw_8bit_420_adither.yuv
ffmpeg version 2.6.3-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers

./ffmpeg -v debug -y -i /mnt/storage/ProRes_10bit_422.mov -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=bayer mnt/storage/raw_8bit_420_bayer.yuv
ffmpeg version 2.6.3-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-16)

'''[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ md5sum /mnt/storage/raw_8bit_420_bayer.yuv
203cb43ecc97aa16d7203626750a14ad  /mnt/storage/raw_8bit_420_bayer.yuv'''
[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ md5sum /mnt/storage/raw_8bit_420_adither.yuv
'''203cb43ecc97aa16d7203626750a14ad  /mnt/storage/raw_8bit_420_adither.yuv'''


commands with full output:
[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$sudo ./ffmpeg -v debug -y -i /mnt/storage/ProRes_10bit_422.mov -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=a_dither mnt/storage/raw_8bit_420_adither.yuv
ffmpeg version 2.6.3-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-16)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument '/mnt/storage/ProRes_10bit_422.mov'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '30'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '36'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=1920:-1:sws_dither=a_dither'.
Reading option 'mnt/storage/raw_8bit_420.yuv_adither.yuv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /mnt/storage/ProRes_10bit_422.mov.
Successfully parsed a group of options.
Opening an input file: /mnt/storage/ProRes_10bit_422.mov.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x48e6680] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x48e6680] Before avformat_find_stream_info() pos: 14083960832 bytes read:253481 seeks:5
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x48e6680] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x48e6680] After avformat_find_stream_info() pos: 98224 bytes read:343513 seeks:6 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/storage/ProRes_10bit_422.mov':
  Metadata:
    creation_time   : 2015-03-26 19:59:36
    timecode        : 00:57:50:00
  Duration: 00:13:49.08, start: 0.000000, bitrate: 135899 kb/s
    Stream #0:0(eng), 1, 1/24000: Video: prores (apch / 0x68637061), yuv422p10le(bt709), 1920x1080, 1/24000, 135654 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng), 0, 1/24000: Data: none (tmcd / 0x64636D74), 1/24, 0 kb/s (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      reel_name       : Unnamed
      timecode        : 00:57:50:00
Successfully opened the file.
Parsing a group of options: output file mnt/storage/raw_8bit_420.yuv_adither.yuv.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 30.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option an (disable audio) with argument 1.
Applying option vf (set video filters) with argument scale=1920:-1:sws_dither=a_dither.
Successfully parsed a group of options.
Opening an output file: mnt/storage/raw_8bit_420.yuv_adither.yuv.
Successfully opened the file.
[Parsed_scale_0 @ 0x48ee3e0] Setting 'w' to value '1920'
[Parsed_scale_0 @ 0x48ee3e0] Setting 'h' to value '-1'
[Parsed_scale_0 @ 0x48ee3e0] Setting 'sws_dither' to value 'a_dither'
[Parsed_scale_0 @ 0x48ee3e0] Setting 'flags' to value '0x4'
[Parsed_scale_0 @ 0x48ee3e0] w:1920 h:-1 flags:'0x4' interl:0
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'pix_fmt' to value '74'
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'time_base' to value '1/24000'
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x48eeae0] Setting 'frame_rate' to value '24000/1001'
[graph 0 input from stream 0:0 @ 0x48eeae0] w:1920 h:1080 pixfmt:yuv422p10le tb:1/24000 fr:24000/1001 sar:1/1 sws_param:flags=2
[format @ 0x48dbb40] compat: called with args=[yuv420p]
[format @ 0x48dbb40] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x48dbe20] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_scale_0 @ 0x48ee3e0] w:1920 h:1080 fmt:yuv422p10le sar:1/1 -> w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x4
detected 32 logical cores
Output #0, rawvideo, to 'mnt/storage/raw_8bit_420.yuv_adither.yuv':
  Metadata:
    timecode        : 00:57:50:00
    encoder         : Lavf56.25.101
    Stream #0:0(eng), 0, 1001/24000: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1001/24000, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc56.26.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Cliping frame in rate conversion by 0.000008
[output stream 0:0 @ 0x48d1fe0] EOF on sink link output stream 0:0:default.kbits/s
No more output streams to write to, finishing.
frame=  720 fps= 63 q=0.0 Lsize= 2187000kB time=00:00:30.03 bitrate=596600.2kbits/s
video:2187000kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (/mnt/storage/ProRes_10bit_422.mov):
  Input stream #0:0 (video): 721 packets read (64913072 bytes); 721 frames decoded;
  Input stream #0:1 (data): 0 packets read (0 bytes);
  Total: 721 packets (64913072 bytes) demuxed
Output file #0 (mnt/storage/raw_8bit_420.yuv_adither.yuv):
  Output stream #0:0 (video): 720 frames encoded; 720 packets muxed (2239488000 bytes);
  Total: 720 packets (2239488000 bytes) muxed
721 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x48ebca0] Statistics: 0 seeks, 68400 writeouts
[AVIOContext @ 0x48e5e40] Statistics: 65166553 bytes read, 71 seeks





[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ sudo ./ffmpeg -v debug -y -i /mnt/storage/ProRes_10bit_422.mov -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=bayer mnt/storage/raw_8bit_420_bayer.yuv
ffmpeg version 2.6.3-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-16)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument '/mnt/storage/ProRes_10bit_422.mov'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '30'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '36'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=1920:-1:sws_dither=bayer'.
Reading option 'mnt/storage/raw_8bit_420.yuv_bayer.yuv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /mnt/storage/ProRes_10bit_422.mov.
Successfully parsed a group of options.
Opening an input file: /mnt/storage/ProRes_10bit_422.mov.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x37a5680] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x37a5680] Before avformat_find_stream_info() pos: 14083960832 bytes read:253481 seeks:5
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x37a5680] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x37a5680] After avformat_find_stream_info() pos: 98224 bytes read:343513 seeks:6 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/storage/ProRes_10bit_422.mov':
  Metadata:
    creation_time   : 2015-03-26 19:59:36
    timecode        : 00:57:50:00
  Duration: 00:13:49.08, start: 0.000000, bitrate: 135899 kb/s
    Stream #0:0(eng), 1, 1/24000: Video: prores (apch / 0x68637061), yuv422p10le(bt709), 1920x1080, 1/24000, 135654 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng), 0, 1/24000: Data: none (tmcd / 0x64636D74), 1/24, 0 kb/s (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      reel_name       : Unnamed
      timecode        : 00:57:50:00
Successfully opened the file.
Parsing a group of options: output file mnt/storage/raw_8bit_420.yuv_bayer.yuv.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 30.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option an (disable audio) with argument 1.
Applying option vf (set video filters) with argument scale=1920:-1:sws_dither=bayer.
Successfully parsed a group of options.
Opening an output file: mnt/storage/raw_8bit_420.yuv_bayer.yuv.
Successfully opened the file.
[Parsed_scale_0 @ 0x37ad3e0] Setting 'w' to value '1920'
[Parsed_scale_0 @ 0x37ad3e0] Setting 'h' to value '-1'
[Parsed_scale_0 @ 0x37ad3e0] Setting 'sws_dither' to value 'bayer'
[Parsed_scale_0 @ 0x37ad3e0] Setting 'flags' to value '0x4'
[Parsed_scale_0 @ 0x37ad3e0] w:1920 h:-1 flags:'0x4' interl:0
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'pix_fmt' to value '74'
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'time_base' to value '1/24000'
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x37adae0] Setting 'frame_rate' to value '24000/1001'
[graph 0 input from stream 0:0 @ 0x37adae0] w:1920 h:1080 pixfmt:yuv422p10le tb:1/24000 fr:24000/1001 sar:1/1 sws_param:flags=2
[format @ 0x379ab40] compat: called with args=[yuv420p]
[format @ 0x379ab40] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x379ae20] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_scale_0 @ 0x37ad3e0] w:1920 h:1080 fmt:yuv422p10le sar:1/1 -> w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x4
detected 32 logical cores
Output #0, rawvideo, to 'mnt/storage/raw_8bit_420.yuv_bayer.yuv':
  Metadata:
    timecode        : 00:57:50:00
    encoder         : Lavf56.25.101
    Stream #0:0(eng), 0, 1001/24000: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1001/24000, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      creation_time   : 2015-03-26 19:59:36
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc56.26.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Cliping frame in rate conversion by 0.000008
[output stream 0:0 @ 0x3790fe0] EOF on sink link output stream 0:0:default.kbits/s
No more output streams to write to, finishing.
frame=  720 fps= 66 q=0.0 Lsize= 2187000kB time=00:00:30.03 bitrate=596600.2kbits/s
video:2187000kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (/mnt/storage/ProRes_10bit_422.mov):
  Input stream #0:0 (video): 721 packets read (64913072 bytes); 721 frames decoded;
  Input stream #0:1 (data): 0 packets read (0 bytes);
  Total: 721 packets (64913072 bytes) demuxed
Output file #0 (mnt/storage/raw_8bit_420.yuv_bayer.yuv):
  Output stream #0:0 (video): 720 frames encoded; 720 packets muxed (2239488000 bytes);
  Total: 720 packets (2239488000 bytes) muxed
721 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x37aaca0] Statistics: 0 seeks, 68400 writeouts
[AVIOContext @ 0x37a4e40] Statistics: 65166553 bytes read, 71 seeks



[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ md5sum /mnt/storage/raw_8bit_420_bayer.yuv
203cb43ecc97aa16d7203626750a14ad  /mnt/storage/raw_8bit_420_bayer.yuv
[Jared@transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ md5sum /mnt/storage/raw_8bit_420_adither.yuv
203cb43ecc97aa16d7203626750a14ad  /mnt/storage/raw_8bit_420_adither.yuv



Change History (17)

comment:1 by Carl Eugen Hoyos, 11 years ago

Priority: criticalnormal

Please test current FFmpeg git head.

comment:2 by surfdog2020, 11 years ago

Last edited 11 years ago by surfdog2020 (previous) (diff)

in reply to:  1 comment:3 by surfdog2020, 11 years ago

Replying to cehoyos:

Please test current FFmpeg git head.

Same thing is still happening , even with the with latest version from git head and the latest version of all libraries.
Here is the output with the new versions numbers of the libraries :
ffmpeg version N-72843-g9c89392 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.6 (Ubuntu/Linaro? 4.6.3-1ubuntu5)
configuration: --prefix=/home/jared/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/jared/ffmpeg_build/include --extra-ldflags=-L/home/jared/ffmpeg_build/lib --bindir=/home/jared/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100

comment:4 by Hendrik, 11 years ago

Try to pass the sws flag to make it print info about the conversion parameters used, I don't remember the syntax off-hand .. but if it says that its using a "specialized" converter, then it won't execute the generic dithering pass. You can usually force the generic path by passing the accurate rounding an full internal chroma flags.

Version 0, edited 11 years ago by Hendrik (next)

comment:5 by surfdog2020, 11 years ago

I'm guessing that you wanted me to add '-sws_flags print_info' to my command line. If that is the case, I see no mention of a "specialized" converter being used. I only see the following get added to my command's output:

SwScaler: reducing / aligning filtersize 1 -> 4

Last message repeated 1 times

SwScaler: reducing / aligning filtersize 1 -> 1
SwScaler: reducing / aligning filtersize 9 -> 8
[swscaler @ 0x43a9060] bicubic scaler, from yuv422p10le to yuv420p using MMXEXT
[swscaler @ 0x43a9060] 1920x1080 -> 1920x1080
[swscaler @ 0x43a9060] lum srcW=1920 srcH=1080 dstW=1920 dstH=1080 xInc=65536 yInc=65536
[swscaler @ 0x43a9060] chr srcW=960 srcH=1080 dstW=960 dstH=540 xInc=65536 yInc=131072

Can you also clarify how one can pass in the "accurate rounding" of the internal chroma flags?

comment:6 by Hendrik, 11 years ago

Try with "-sws_flags +accurate_rnd+full_chroma_inp+full_chroma_int", that should hopefully make it perform a high quality conversion with dithering. The last option is probably not needed for your use-case, IIRC its only needed when you upsample chroma, not downsample.

comment:7 by surfdog2020, 11 years ago

I'm looking to be able to specify the dithering algorithm used on the 10-bit to 8-bit conversion. I tried:
./ffmpeg -v debug -sws_flags +accurate_rnd+full_chroma_inp+full_chroma_int -y -i /mnt/storage/ProRes_10bit_422.mov -sws_dither a_dither -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=a_dither /mnt/storage/raw_8bit_420_adither.yuv

./ffmpeg -v debug -sws_flags +accurate_rnd+full_chroma_inp+full_chroma_int -y -i /mnt/storage/ProRes_10bit_422.mov -sws_dither bayer -t 30 -pix_fmt yuv420p -an -threads 36 -vf scale=1920:-1:sws_dither=bayer /mnt/storage/raw_8bit_420_bayer.yuv

Both output files are still equal to each other, have the same md5 value.

Last edited 11 years ago by surfdog2020 (previous) (diff)

comment:8 by Michael Niedermayer, 11 years ago

Component: undeterminedswscale
Status: newopen
Summary: sws_dither arguments aren't affecting output in colorspace conversion10bit->8bit user selectable dither
Type: defectenhancement
Version: 2.6.3git-master

I dont think this case is supported currently but it would be nice to add support for

in reply to:  8 comment:9 by surfdog2020, 11 years ago

Replying to michael:

I dont think this case is supported currently but it would be nice to add support for

The documentation says that this should be already supported, see: https://ffmpeg.org/ffmpeg-all.html#Scaler-Options, this was my reasoning in marking it as a defect instead of enhancement.

Regardless of the label, I agree that this is functionality that would be beneficial to have, as some folks prefer one way of dithering over another.

comment:10 by Carl Eugen Hoyos, 11 years ago

Keywords: sws_dither removed
Priority: normalwish

comment:11 by gdgsdg123, 7 years ago

Summary: 10bit->8bit user selectable ditherYUV 10bpc (10-bit per component) -> 8bpc, user controlled dithering

comment:12 by gdgsdg123, 7 years ago

Build from: https://zeranoe.com/builds/win64/static/win64/static/ffmpeg-20190416-036b4b0-win64-static.zip


It's still the case in recent version.



What if one preferred no dither? (for the sake of compressibility... or just because banding/discoloration is preferred over noise)







Suggested workaround (for no dither):
YUV 10bpc -> RGB24 -> YUV 8bpc


And don't forget this...



Or use zscale?..

Last edited 7 years ago by gdgsdg123 (previous) (diff)

comment:13 by gdgsdg123, 7 years ago

Summary: YUV 10bpc (10-bit per component) -> 8bpc, user controlled ditheringswscale YUV 10bpc (10-bit per component) -> 8bpc, user controlled dithering

comment:14 by Balling, 5 years ago

That is no longer the case with -vf scale=sws_dither=0 or -scale=sws_dither=none, both produce same results different from auto dither.

Please test! Please note that there still appears some dither from 10 bit to 8 bit that produces a pair of colors instead of one.

Last edited 5 years ago by Balling (previous) (diff)

in reply to:  12 ; comment:15 by MasterQuestionable, 21 months ago

͏    This suggested workaround mostly doesn't work:
͏    As demonstrated: https://trac.ffmpeg.org/ticket/11254
͏    (<colorspace> images origin from)

in reply to:  15 comment:16 by Balling, 21 months ago

Replying to MasterQuestionable:

͏    This suggested workaround mostly doesn't work:
͏    As demonstrated: https://trac.ffmpeg.org/ticket/11254
͏    (<colorspace> images origin from)

It does work. Before saying stuff check md5 of the produced file.

comment:17 by MasterQuestionable, 21 months ago

Cc: MasterQuestionable added

͏    The "RGB24 -> YUV 8bpc" maybe working.
͏    While the later YUV 8bpc -> RGB24 apparently failed.

Note: See TracTickets for help on using tickets.