How to add web cam(video) recording as overlay using ffmpeg

0

0

I have created following command to overlay image in video (desktop recording ):

C:\>ffmpeg -y -rtbufsize 100M -f gdigrab -framerate 20 -offset_x 0 -offset_y 0 -video_size 1250x750 -draw_mouse 1 -i desktop -f dshow -i audio="Microphone (High
 Definition Audio Device)" -c:v libx264 -r 20 -preset ultrafast -tune zerolatency -crf 30 -pix_fmt yuv420p -c:a libmp3lame -qscale:a 4 "D:\today.mp4"  -i "C:\My.jpg"  -filter_complex "pad=height=ih+10:color=black,overlay=(main_w-overlay_w):main_h-overlay_h"

And able to see expected result, but when I am using my web cam as

video="HP Truevision HD"

instead of image file, i am getting error as its trying to find image.

Anupam Singh

Posted 2016-05-01T08:31:25.563

Reputation: 113

Answers

1

Use

ffmpeg -y -rtbufsize 100M -f gdigrab -framerate 20 -offset_x 0 -offset_y 0
       -video_size 1250x750 -draw_mouse 1 -i desktop
       -f dshow -i video="HP Truevision HD":audio="Microphone (High Definition Audio Device)"
       -filter_complex "[0]pad=height=ih+10:color=black[b];
                        [b][1:v]overlay=(main_w-overlay_w):main_h-overlay_h[v]" -map "[v]"
       -c:v libx264 -r 20 -preset ultrafast -tune zerolatency -crf 30 -pix_fmt yuv420p
       -map 1:a -c:a libmp3lame -qscale:a 4 "D:\today.mp4"  

Gyan

Posted 2016-05-01T08:31:25.563

Reputation: 21 016

Thanks @Malvya, there seems frame-rate issue but I will fix it now. Will let you know. – Anupam Singh – 2016-05-02T03:50:07.730

Hi @Malvya, its bit difficult to understand ffmpeg command as I spend a week to figure out the frame rate latency (in overlay) and scale overlay video with no success. could you please help me in this. – Anupam Singh – 2016-05-09T17:38:07.760