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=\"Microphon
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.
I used this to record the prompt
ffmpeg -rtbufsize 1500M -f dshow -i audio="Microfono (8- Logitech USB Headset)" -f gdigrab -framerate 30 -draw_mouse 1 -i title="Prompt dei comandi" -pix_fmt yuv420p -profile:v baseline -y output\output3_xp.mp4
pause
But it works only with 100x20 (colxrow) fo the prompt or other divisible screen size, otherwise it gives me an error, this:
[libx264 @ 0000027c7ed66200] width not divisible by 2 (269x432)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
P.S.: I have this problem also with other windows that has not even width or height. I created a window with tkinter in Python and I get the error, then I gave the window some geometry (300x500) and it worked...
Strangely, the mouse is a little offset...
I was also looking for a solution online, but was not satisfied with the answers I found. I have now fiddled together this very simplistic solution for linux:
ffmpeg -f x11grab -framerate 25 \
$(xwininfo | gawk 'match($0, /-geometry ([0-9]+x[0-9]+).([0-9]+).([0-9]+)/, a)\
{ print "-video_size " a[1] " -i +" a[2] "," a[3] }') \
$(date +%Y-%m-%d_%H-%M_%S).mp4
After executing this command the window can be selected with the mouse pointer
The target filename will take the form YYYY-mm-dd_hh_mm_ss.mp4
in the current directory.
The awk magic there just parses the window info. It is ugly and only works with gnu awk, but I have not found a better way yet to parse the window geometry into a custom format.
The syntax to record a specific rectangle on screen is:
-video_size [width]x[height] -i [x],[y]
and should also work under windows and with dshow, I believe.
It has mentioned in here:
By default, it captures the "full screen" of the main desktop monitor (all windows, overlapping, from there, with aero if vista+, without transparent windows if non aero).
To configure it differently, run the provided "configuration setup utilities/shortcuts" or adjust registry settings before starting a run (advanced users only):
HKEY_CURRENT_USER\Software\screen-capture-recorder
with DWORD keys respected of start_XXX etc … (see the included file {installdir}\configuration_setup_utility\setup_screen_tracker_params.rb for the full list of registry key values available, or see https://github.com/rdp/screen-capture-recorder-to-video-windows-free/blob/master/configuration_setup_utility/setup_screen_tracker_params.rb#L9 )
ex: see configuration_setup_utility\incoming.reg file (though NB that those values are in hex, so editing that file is a bit tedious-- I always just use regedit or the accompanying script utilities and don’t edit it by hand).
To "reset" a value delete its key.
And you can see in here that there are these registery options:
ffmpeg -f x11grab -framerate 25
$(xwininfo | gawk 'match($0, /-geometry ([0-9]+x[0-9]+).([0-9]+).([0-9]+)/, a)
{ print "-video_size " a[1] " -i +" a[2] "," a[3] }')
$(date +%Y-%m-%d_%H-%M_%S).mp4
This doesn't work on windows where xwininfo returns the "size" portion of the geometry in character cells instead of pixels (e.g. terminal windows). To fix this, the size needs to be extracted from the Width: and Height: fields of the xwininfo response.
ffmpeg -rtbufsize 1500M -f dshow -i audio="virtual-audio-capturer" -f gdigrab -framerate 30 -draw_mouse 1 -i title=RecordWindow -pix_fmt yuv420p -profile:v baseline -y Huangbaohua.mp4
the RecordWindow is the title of a specified window.