cytopia/ffscreencast

Camera: unlabeled input pad 1 on filter Parsed_overlay_0

rafi opened this issue · 6 comments

rafi commented

I'm receiving following error when trying to add camera overlay:

Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_0

$ : ffscreencast -c
/opt/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation  -i "1" -thread_queue_size 512 -f avfoundation -video_size 160x120 -framerate-i "0" -c:v libx264 -crf 0 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 "/Users/rafi/Desktop/Screencast 2017-03-17 at 15.06.11.mkv"
[avfoundation @ 0x7f88f2003400] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7f88f2003400] Supported pixel formats:
[avfoundation @ 0x7f88f2003400]   uyvy422
[avfoundation @ 0x7f88f2003400]   yuyv422
[avfoundation @ 0x7f88f2003400]   nv12
[avfoundation @ 0x7f88f2003400]   0rgb
[avfoundation @ 0x7f88f2003400]   bgr0
[avfoundation @ 0x7f88f2003400] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7f88f2003400] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '1':
  Duration: N/A, start: 240804.105833, bitrate: N/A
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2880x1800, 1000k tbr, 1000k tbn, 1000k tbc
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_0
$ ffscreencast --test
[OK]   Operating system supported: Darwin
[OK]   ffmpeg found: /opt/local/bin/ffmpeg
[OK]   [OSX]: AVFoundation available in ffmpeg.
          + Desktop recording possible.
          + Sound recording possible.
          + Camera overlay possible.
$ ffscreencast --list
Available screen recording devices (monitors):

[1] Capture screen 0


Available audio recording devices (monitors):

[0] Wirecast Virtual Microphone
[1] Built-in Microphone
[2] Boom2Device


Available camera recording devices:

[0] FaceTime HD Camera (Built-in) (160x120@ 29.970000]fp 160x120@ 25.000000]fp 160x120@ 23.999981]fp 160x120@ 14.999993]fp 176x144@ 29.970000]fp 176x144@ 25.000000]fp 176x144@ 23.999981]fp 176x144@ 14.999993]fp 320x240@ 29.970000]fp 320x240@ 25.000000]fp 320x240@ 23.999981]fp 320x240@ 14.999993]fp 352x288@ 29.970000]fp 352x288@ 25.000000]fp 352x288@ 23.999981]fp 352x288@ 14.999993]fp 480x360@ 29.970000]fp 480x360@ 25.000000]fp 480x360@ 23.999981]fp 480x360@ 14.999993]fp 640x480@ 29.970000]fp 640x480@ 25.000000]fp 640x480@ 23.999981]fp 640x480@ 14.999993]fp 960x540@ 29.970000]fp 960x540@ 25.000000]fp 960x540@ 23.999981]fp 960x540@ 14.999993]fp 1024x576@ 29.970000]fp 1024x576@ 25.000000]fp 1024x576@ 23.999981]fp 1024x576@ 14.999993]fp 1280x720@ 29.970000]fp 1280x720@ 25.000000]fp 1280x720@ 23.999981]fp 1280x720@ 14.999993]fp)
$ ffmpeg -version
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --disable-outdev=xv --enable-audiotoolbox --enable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --enable-videotoolbox --arch=x86_64 --enable-yasm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
libavutil      55. 34.101 / 55. 34.101
libavcodec     57. 64.101 / 57. 64.101
libavformat    57. 56.101 / 57. 56.101
libavdevice    57.  1.100 / 57.  1.100
libavfilter     6. 65.100 /  6. 65.100
libavresample   3.  1.  0 /  3.  1.  0
libswscale      4.  2.100 /  4.  2.100
libswresample   2.  3.100 /  2.  3.100
libpostproc    54.  1.100 / 54.  1.100

@rafi could you paste the --dry output. Also as I don't have a Mac anymore, could you adjust the command from --dry to fit the suggestion here: https://stackoverflow.com/questions/35251122/using-ffmpeg-to-add-overlay-with-opacity

rafi commented

Changing the -filter_complex from original command (using --dry):

/opt/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation -i "1" -thread_queue_size 512 -f avfoundation -video_size 160
x120 -framerate -i "0" -c:v libx264 -crf 0 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 "/Users/rafi/Desktop/Screencast 2017-03-18 at 15.12.04.mkv"

to

/opt/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation -i "1" -thread_queue_size 512 -f avfoundation -video_size 160
x120 -framerate -i "0" -c:v libx264 -crf 0 -preset ultrafast -filter_complex "[0:v]setsar=sar=1[v];[v][1]blend=all_mode='overlay':all_opacity=0.7" -threads 0 "/Users/rafi/Desktop/Screencast 2017-03-18 at 15.12.04.mkv"

via recommendation from suggested post gives me this error:

Invalid file index 1 in filtergraph description [0:v]setsar=sar=1[v];[v][1]blend=all_mode='overlay':all_opacity=0.7.

Hmm that's unfortunate. For now I am afraid you have to find a solution on your own, as I don't have a mac anymore to test things out.

I will leave this open for others to see who might provide some help.
Btw, could you try to discuss your problem on stackoverflow/reddit and see if you get a nice solution for your ffmpeg problem.

I met the same problem and on macOS 10.12.3, camera and audio recording failed

➜  Desktop ffscreencast --test
[OK]   Operating system supported: Darwin
[OK]   ffmpeg found: /usr/local/bin/ffmpeg
[OK]   [OSX]: AVFoundation available in ffmpeg.
          + Desktop recording possible.
          + Sound recording possible.
          + Camera overlay possible.
➜  Desktop ffscreencast --list
Available screen recording devices (monitors):

[1] Capture screen 0


Available audio recording devices (monitors):

[0] Built-in Microphone


Available camera recording devices:

[0] FaceTime HD Camera (Built-in) (160x120@ 29.970000]fp 160x120@ 25.000000]fp 160x120@ 23.999981]fp 160x120@ 14.999993]fp 176x144@ 29.970000]fp 176x144@ 25.000000]fp 176x144@ 23.999981]fp 176x144@ 14.999993]fp 320x240@ 29.970000]fp 320x240@ 25.000000]fp 320x240@ 23.999981]fp 320x240@ 14.999993]fp 352x288@ 29.970000]fp 352x288@ 25.000000]fp 352x288@ 23.999981]fp 352x288@ 14.999993]fp 480x360@ 29.970000]fp 480x360@ 25.000000]fp 480x360@ 23.999981]fp 480x360@ 14.999993]fp 640x480@ 29.970000]fp 640x480@ 25.000000]fp 640x480@ 23.999981]fp 640x480@ 14.999993]fp 960x540@ 29.970000]fp 960x540@ 25.000000]fp 960x540@ 23.999981]fp 960x540@ 14.999993]fp 1024x576@ 29.970000]fp 1024x576@ 25.000000]fp 1024x576@ 23.999981]fp 1024x576@ 14.999993]fp 1280x720@ 29.970000]fp 1280x720@ 25.000000]fp 1280x720@ 23.999981]fp 1280x720@ 14.999993]fp)
➜  Desktop ffmpeg -version
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil      55. 34.101 / 55. 34.101
libavcodec     57. 64.101 / 57. 64.101
libavformat    57. 56.101 / 57. 56.101
libavdevice    57.  1.100 / 57.  1.100
libavfilter     6. 65.100 /  6. 65.100
libavresample   3.  1.  0 /  3.  1.  0
libswscale      4.  2.100 /  4.  2.100
libswresample   2.  3.100 /  2.  3.100
libpostproc    54.  1.100 / 54.  1.100
➜  Desktop  ffscreencast -c0
/usr/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation  -i "1" -thread_queue_size 512 -f avfoundation -video_size 160x120 -framerate   -i "0" -c:v libx264 -crf 0 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 "/Users/kewin/Desktop/Screencast 2017-03-31 at 23.01.45.mkv"
[avfoundation @ 0x7fde87000000] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fde87000000] Supported pixel formats:
[avfoundation @ 0x7fde87000000]   uyvy422
[avfoundation @ 0x7fde87000000]   yuyv422
[avfoundation @ 0x7fde87000000]   nv12
[avfoundation @ 0x7fde87000000]   0rgb
[avfoundation @ 0x7fde87000000]   bgr0
[avfoundation @ 0x7fde87000000] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7fde87000000] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '1':
  Duration: N/A, start: 27320.825167, bitrate: N/A
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2560x1600, 1000k tbr, 1000k tbn, 1000k tbc
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_0
➜  Desktop  ffscreencast -a0
/usr/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation  -i "1" -thread_queue_size 512 -f avfoundation -ac 2 -i ":0" -c:a libfaac -c:v libx264 -crf 0 -preset ultrafast -threads 0 "/Users/kewin/Desktop/Screencast 2017-03-31 at 23.01.53.mkv"
[avfoundation @ 0x7ff5c1002600] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7ff5c1002600] Supported pixel formats:
[avfoundation @ 0x7ff5c1002600]   uyvy422
[avfoundation @ 0x7ff5c1002600]   yuyv422
[avfoundation @ 0x7ff5c1002600]   nv12
[avfoundation @ 0x7ff5c1002600]   0rgb
[avfoundation @ 0x7ff5c1002600]   bgr0
[avfoundation @ 0x7ff5c1002600] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7ff5c1002600] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '1':
  Duration: N/A, start: 27327.773167, bitrate: N/A
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2560x1600, 1000k tbr, 1000k tbn, 1000k tbc
Input #1, avfoundation, from ':0':
  Duration: N/A, start: 27328.415578, bitrate: 2822 kb/s
    Stream #1:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s
Unknown encoder 'libfaac'

And
I Have rebuild ffmpeg 3.2.4 , found have not with-faac option , so how to resolve or any alternative solution

I just want to chime in here because I hit a similar error but a different cause.

I was calling -acodec aac before a second input -i watermark.png and I got the same error.

After moving my -acodec aac to after the second input and before the output, everything worked.

For what it's worth, I got the exact same error as @rafi on my Mac.
I was able to get the desired result (but not fix the ffscreencast command) using this command:

ffmpeg -thread_queue_size 50 -f avfoundation -framerate 30 -i "1" -thread_queue_size 50 -f avfoundation -framerate 30 -video_size 640x480 -i "0" -c:v libx264 -crf 18 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -capture_cursor 1 -capture_mouse_clicks 1 -r 30 ~/Desktop/out.mkv

Perhaps a better man could piece together what is needed into the original ffscreencast command