IAmDamoSuzuki
IAmDamoSuzuki

Reputation: 33

FFmpeg screen blend mode turns image pink

I'm having trouble using the screen blend mode. I'm trying to create a video delay/echo effects. I have things working fairly well, but whenever I try to use the screen blend mode I get a pink image. Other blend modes don't have this issue, but the screen mode is likely going to give me the best visual results.

I see that someone else asked a similar question here, and the answers suggested converting to RGBa before doing the blends. I've tried this and it didn't work. Here's my code and ffmpeg info.

ffmpeg -i sampleVideo.mov -c:v prores -profile:v 3 -filter_complex "split[dry][toEcho];[toEcho]setpts=PTS+0.2/TB[wet];[wet][dry]blend=all_mode=screen:all_opacity=1,format=yuv422p10le[out]" -map [out] sampleVideo_echo.mov

ffmpeg info:

ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/morgan/Movies/AVAA/TapeDamage01.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:05.16, start: 0.000000, bitrate: 3717 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 81:80 DAR 27:20], 3560 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      handler_name    : Apple Sound Media Handler
File '/Users/morgan/Movies/AVAA/TapeDamage01_echo.mov' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 (h264) -> split
  format -> Stream #0:0 (prores)
Press [q] to stop, [?] for help
Output #0, mov, to '/Users/morgan/Movies/AVAA/TapeDamage01_echo.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le, 640x480 [SAR 81:80 DAR 27:20], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 prores

Here's a sample of the input file:

sample input file

and here's the pink output

enter image description here

Upvotes: 0

Views: 1313

Answers (2)

w shen
w shen

Reputation: 21

You should change pixel format to gbrp (use format=gbrp). Read more for details.

Upvotes: 1

to view all blend modes:

#!/bin/bash
for i in  addition ‘grainmerge and average burn darken difference grainextract divide dodge freeze exclusion extremity glow hardlight hardmix heat lighten linearlight multiply multiply128 negation normal or overlay phoenix pinlight  reflect screen softlight subtract vividlight xor; do
  ffplay -autoexit -t 2 -vf "
  split[dry][toEcho];
  [toEcho]setpts=PTS+0.2/TB[wet];
  [wet][dry]blend=all_mode=${i}:all_opacity=1[bl];
  [bl]drawtext=text=${i}:fontsize=100:fontcolor=white[out]
  " sampleVideo.mov
done

https://ffmpeg.org/ffmpeg-filters.html#blend-1

Upvotes: 1

Related Questions