How to record a specific window using ffmpeg?

Matin Lotfaliee picture Matin Lotfaliee · Aug 20, 2014 · Viewed 30.5k times · Source

I use ffmpeg to record a window using this code:

ffmpeg.exe
-f dshow 
-y 
-i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)" 
-framerate 15 
-vcodec libx264 
-crf 0 
-preset ultrafast 
-acodec pcm_s16le 
-vf crop=Width:Height:Left:Top 
output.flv

But the problem is i might move the window, this leads to recording an area without the window i want.

How can i capture a specific window that I am able to move it?


Edit: I also used gdigrab to capture my window (Skype for instance) instead of dshow:

ffmpeg.exe
-y
-f dshow
-i audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)"
-f gdigrab
-draw_mouse 0
-i title="Skype"
-framerate 30
-vcodec libx264
-crf 0
-preset ultrafast
-acodec pcm_s16le
output.flv

But the conference is black...

Answer

RdB picture RdB · Jun 18, 2015

This example works for me:

ffmpeg -f gdigrab -framerate 30 -i title="german.avi - VLC media player" -b:v 3M  germ.flv

where "title" means actual title of a target window.

Hope this will help.