[FFmpeg-user] Strange PNG overlay issue

Bouke / Videotoolshed bouke at videotoolshed.com
Fri May 12 14:36:24 EEST 2023


Trying to compare video files to find differences.
I have two very identical files, same codec, but one has a slight color correction.
Using the difference matting I’m able to find that.

But, I would also like to be able to mask out certain parts, in case there is BITC or a bug in the image.
For that I use a PNG file with alpha.

That does not work as expected:

Please compare the two lines, and note the PNG is TOTALLY EMPTY, alpha set to fully transparent:

Without the overlay:

FFmpeg -ss 19.126 -i /Volumes/Data/!BoukeWatch/Filemail/altered.mov -ss 19.126 -i /Volumes/Data/!BoukeWatch/Filemail/orig.mov -t 0.04 -shortest -filter_complex [0:v]scale=640:360[v0];[1:v]scale=640:360[v1];[v0][v1]blend=all_mode=difference -pix_fmt gray -c:v png -start_number 459 /Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png -y 

Output is as expected, a very dark image, but with the image as greyscale

FFmpeg -ss 19.126 -i /Volumes/Data/!BoukeWatch/Filemail/altered.mov -ss 19.126 -i /Volumes/Data/!BoukeWatch/Filemail/orig.mov -t 0.04 -i /Users/bouke/Library/Application Support/DifferenceFinder/presets/scaled.png -t 0.04 -shortest -filter_complex [0:v]scale=640:360[tmp1];[tmp1][2:v]overlay=0:0[v0];[1:v]scale=640:360[tmp2];[tmp2][2:v]overlay=0:0[v1];[v0][v1]blend=all_mode=difference -pix_fmt gray -c:v png -start_number 459 /Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png -y 

This results in a pure black image, where I would expect the output to be the same as in the first line...
What am I missing here?

Bouke

videotoolshed.com
Van Oldenbarneveltstraat 33
6512 AS Nijmegen, the Netherlands
+31 6 21817248
If you want to send me large files, please use:
https://videotoolshed.wetransfer.com/
Test without overlay:
FFmpeg -ss 19.12686868686866 -i /Volumes/Data/!BoukeWatch/Filemail/altered.mov -ss 19.12686868686866 -i /Volumes/Data/!BoukeWatch/Filemail/orig.mov -t 0.04 -shortest -filter_complex [0:v]scale=640:360[v0];[1:v]scale=640:360[v1];[v0][v1]blend=all_mode=difference -pix_fmt gray -c:v png -start_number 459 /Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png -y 

ffmpeg version 6.0-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/!BoukeWatch/Filemail/altered.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2023-05-08T18:14:44.000000Z
    encoder         : Blackmagic Design DaVinci Resolve Studio
  Duration: 00:00:47.34, start: 0.000000, bitrate: 79144 kb/s
  Stream #0:0[0x1]: Video: prores (LT) (apcs / 0x73637061), yuv422p10le(bt709/bt709/unknown, progressive), 1920x1080, 76070 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : VideoHandler
      vendor_id       : appl
      encoder         : Apple ProRes 422 LT
      timecode        : 01:00:00:00
  Stream #0:1[0x2]: Audio: pcm_s32le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32, 3072 kb/s (default)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : 
SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : TimeCodeHandler
      reel_name       : Musica_WIP_graded_h264_refAudio_230502
      timecode        : 01:00:00:00

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/!BoukeWatch/Filemail/orig.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2023-05-08T18:06:58.000000Z
    encoder         : Blackmagic Design DaVinci Resolve Studio
  Duration: 00:00:47.34, start: 0.000000, bitrate: 79166 kb/s
  Stream #1:0[0x1]: Video: prores (LT) (apcs / 0x73637061), yuv422p10le(bt709/bt709/unknown, progressive), 1920x1080, 76092 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : VideoHandler
      vendor_id       : appl
      encoder         : Apple ProRes 422 LT
      timecode        : 01:00:00:00
  Stream #1:1[0x2]: Audio: pcm_s32le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32, 3072 kb/s (default)
    Metadata:
      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #1:2[0x3](eng): Data: none (tmcd / 0x64636D74)

    Metadata:
      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : TimeCodeHandler
      reel_name       : Musica_WIP_graded_h264_refAudio_230502
      timecode        : 01:00:00:00

Stream mapping:
  Stream #0:0 (prores) -> scale:default
  Stream #1:0 (prores) -> scale:default
  blend:default -> Stream #0:0 (png)
Press [q] to stop, [?] for help

Output #0, image2, to '/Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf60.3.100
  Stream #0:0: Video: png, gray(pc, bt709/bt709/unknown, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn
    Metadata:
      encoder         : Lavc60.3.100 png
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
video:69kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

////////// 
Test with overlay:

FFmpeg -ss 19.12686868686866 -i /Volumes/Data/!BoukeWatch/Filemail/altered.mov -ss 19.12686868686866 -i /Volumes/Data/!BoukeWatch/Filemail/orig.mov -t 0.04 -i /Users/bouke/Library/Application Support/DifferenceFinder/presets/scaled.png -t 0.04 -shortest -filter_complex [0:v]scale=640:360[tmp1];[tmp1][2:v]overlay=0:0[v0];[1:v]scale=640:360[tmp2];[tmp2][2:v]overlay=0:0[v1];[v0][v1]blend=all_mode=difference -pix_fmt gray -c:v png -start_number 459 /Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png -y 
ffmpeg version 6.0-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/!BoukeWatch/Filemail/altered.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2023-05-08T18:14:44.000000Z
    encoder         : Blackmagic Design DaVinci Resolve Studio
  Duration: 00:00:47.34, start: 0.000000, bitrate: 79144 kb/s
  Stream #0:0[0x1]: Video: prores (LT) (apcs / 0x73637061), yuv422p10le(bt709/bt709/unknown, progressive), 1920x1080, 76070 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : VideoHandler
      vendor_id       : appl
      encoder         : Apple ProRes 422 LT
      timecode        : 01:00:00:00

  Stream #0:1[0x2]: Audio: pcm_s32le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32, 3072 kb/s (default)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2023-05-08T18:14:44.000000Z
      handler_name    : TimeCodeHandler
      reel_name       : Musica_WIP_graded_h264_refAudio_230502
      timecode        : 01:00:00:00

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/!BoukeWatch/Filemail/orig.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2023-05-08T18:06:58.000000Z
    encoder         : Blackmagic Design DaVinci Resolve Studio
  Duration: 00:00:47.34, start: 0.000000, bitrate: 79166 kb/s
  Stream #1:0[0x1]: Video: prores (LT) (apcs / 0x73637061), yuv422p10le(bt709/bt709/unknown, progressive), 1920x1080, 76092 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : VideoHandler
      vendor_id       : appl
      encoder         : Apple ProRes 422 LT
      timecode        : 01:00:00:00
  Stream #1:1[0x2]: Audio: pcm_s32le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32, 3072 kb/s (default)
    Metadata:
      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #1:2[0x3](eng): Data: none (tmcd / 0x64636D74)
    Metadata:

      creation_time   : 2023-05-08T18:06:58.000000Z
      handler_name    : TimeCodeHandler
      reel_name       : Musica_WIP_graded_h264_refAudio_230502
      timecode        : 01:00:00:00

Input #2, png_pipe, from '/Users/bouke/Library/Application Support/DifferenceFinder/presets/scaled.png':
  Duration: N/A, bitrate: N/A
  Stream #2:0: Video: png, rgba(pc), 640x360 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn

Stream mapping:
  Stream #0:0 (prores) -> scale:default
  Stream #1:0 (prores) -> scale:default
  Stream #2:0 (png) -> overlay
  Stream #2:0 (png) -> overlay
  blend:default -> Stream #0:0 (png)
Press [q] to stop, [?] for help

Output #0, image2, to '/Volumes/Data/!BoukeWatch/Filemail/altered_vs_orig/%06d.png':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf60.3.100
  Stream #0:0: Video: png, gray(pc, bt709/bt709/unknown, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn
    Metadata:
      encoder         : Lavc60.3.100 png

frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown




More information about the ffmpeg-user mailing list