1

I want to record a certain program window via FFMPEG, but x11 can't capture window. Is there some way to do it on Linux?

On Windows I can do this:

ffmpeg -f gdigrab -framerate 30 -i title="System Monitor" -b:v 3M test.flv

But how can I do the same window capture on Linux via title=System Monitor?

x11grab does not support title=

fixer1234
  • 27,064
  • 61
  • 75
  • 116
Yove
  • 11
  • 2
  • 1
    Are you referring to a Microsoft Windows application, or a Linux application and you're having trouble getting FFMPEG to capture its window? Can you provide more detail on your situation? – fixer1234 May 13 '19 at 06:20
  • On Windows I can do this - `ffmpeg -f gdigrab -framerate 30 -i title="System Monitor" -b:v 3M test.flv` But how can I do the same window capture on Linux via `title=System Monitor`? x11grab does not support `title=` – Yove May 13 '19 at 07:30
  • https://superuser.com/a/1378465/ – Yai0Phah Oct 22 '20 at 22:21
  • Hi @Yove, Did you get any solution for this? – CuriousMind Mar 31 '21 at 12:30

2 Answers2

3

There is no feature to capture specific windows with x11grab in ffmpeg, but you can manually provide the coordinates to do so.

Use xwininfo to get the geometry of the target window:

$ xwininfo
  Please select the window about which you would like
  information by clicking the mouse in that window.
  [...]
  -geometry 80x24-61-68

This translates to a command in ffmpeg that looks like:

ffmpeg -video_size 80x24 -f x11grab -i :0.0+61,68 output

The recording area is fixed, so if the window moves it can go outsize of the recording area. It is also not exclusive, so if another window covers the recording area then that will also get recorded.

llogan
  • 57,139
  • 15
  • 118
  • 145
  • Please re-read the question, I know that x11 cannot capture window, the question is whether it is possible to capture a specific window, not the screen area – Yove May 14 '19 at 08:26
  • @Yove Your question did not elaborate this. New answer added. – llogan May 14 '19 at 17:28
  • Ugh. My own use case for recording a specific window is to allow the window to be recording while it's behind something while I do something else on this screen. – Michael Jan 22 '22 at 22:53
1

I know that x11 cannot capture window, the question is whether it is possible to capture a specific window, not the screen area

Currently not possible using ffmpeg in Linux.

llogan
  • 57,139
  • 15
  • 118
  • 145