[FFmpeg-user] Resolving -filter_complex overlay / -vf yadif conflicts in subprocess call Python script

pittschick at me.com pittschick at me.com
Wed Sep 11 14:18:57 EEST 2019


Hello!

Thanks for admitting me to FFmpeg-user, and thanks to all those who maintain this list. The information I’ve been receiving since joining is outstanding.

This is a bit of a basic question I fear, but searching online hasn’t helped.  I am just co-writing a Python script which uses subprocess calls to run an FFmpeg command. I’ve been try to combine a watermark overlay with a command that uses yadif.  As a command it would run like so:

ffmpeg -i input_file -i watermark.png -filter_complex overlay -c:v libx263 -pix_fmt yuv420p -vf yadif -metadata copyright=“blah” -metadata comment=“contact blah” -c:a aaa -report output_file

For reference, the script is here: https://github.com/digitensions/MACEscripts/blob/master/main.py

My error message:
ffmpeg started on 2019-09-11 at 11:12:45
Report written to "ffmpeg-20190911-111245.log"
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --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-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Joanna/Desktop/new(ScriptTest)/[Chimney].mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.20.100
  Duration: 00:00:26.32, start: 0.000000, bitrate: 163608 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080, 162452 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.35.100 prores_ks
      timecode        : 01:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 01:00:00:00
Input #1, png_pipe, from '/Users/Joanna/Desktop/new(ScriptTest)/bitc/venv/watermarks/FHD.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Filtergraph 'yadif' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
-vf/-af/-filter and -filter_complex cannot be used together for the same stream.
(venv) Joanna:venv Joanna$ 

I’m aware my source is progressive, my only available test file at present. I tried a few options combining yadif with the -filter_complex and had no success, but I wonder if those more knowledgeable would have an effective work around, or could point me to one?

The alternative is to write an if statement that checks for interlacing and activates the yadif call separately, which I’m happy to attempt if needed.

Any advice gratefully received.

Joanna White



More information about the ffmpeg-user mailing list