[FFmpeg-trac] #4614(undetermined:new): sws_dither arguments aren't affecting output in colorspace conversion

FFmpeg trac at avcodec.org
Thu Jun 11 20:52:36 CEST 2015


#4614: sws_dither arguments aren't affecting output in colorspace conversion
-------------------------------------+-------------------------------------
             Reporter:  surfdog2020  |                     Type:  defect
               Status:  new          |                 Priority:  critical
            Component:               |                  Version:  2.6.3
  undetermined                       |               Blocked By:
             Keywords:  sws_dither   |  Reproduced by developer:  0
  dithering                          |
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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 at 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 at 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 at 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 at 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 at 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 at transcoder:~/Downloads/ffmpeg-2.6.3-64bit-static]$ md5sum
 /mnt/storage/raw_8bit_420_adither.yuv
 203cb43ecc97aa16d7203626750a14ad  /mnt/storage/raw_8bit_420_adither.yuv



 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4614>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list