I would like to use ffmpeg to record my desktop as well as my camera as an overlay on top of the desktop.
So basically I will have two input sources that need to be recorded
$ ffmpeg -f avfoundation -list_devices true -i ''
[AVFoundation input device @ 0x7fded1c223e0] AVFoundation video devices:
[AVFoundation input device @ 0x7fded1c223e0] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7fded1c223e0] [1] Capture screen 0
[AVFoundation input device @ 0x7fded1c223e0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fded1c223e0] [0] Built-in Microphone
From the above, I need [0] FaceTime HD Camera as an overlay and [1] Capture screen 0 as the main video.
Is this even possible?
UPDATE (2015-10-06):
I found the following command from ffscreencast:
ffmpeg \
-f avfoundation -i "1" \
-f avfoundation -r 30 -video_size 640x480 -i "0" \
-c:v libx264 -crf 0 -preset ultrafast \
-filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' "out.mkv"
Unfortunately the output has a pretty slow framerate (i7 Macbook Pro 2014)
Output #0, matroska, to 'out.mkv':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 3840x2400, q=-1--1, 1000k fps, 1k tbn, 1000k tbc (default)
Metadata:
encoder : Lavc56.60.100 libx264
Stream mapping:
Stream #0:0 (rawvideo) -> overlay:main
Stream #1:0 (rawvideo) -> overlay:overlay
overlay -> Stream #0:0 (libx264)
frame= 756 fps=9.1 q=-1.0 Lsize= 193660kB time=00:01:21.86 bitrate=19378.5kbits/s
Press [q] to stop, [?] for help
Anyone an idea of how to get a higher framerate? My camera is only able to record at 30 frames per second, but the output seems to only have around 9 frames. Why the difference?