6

Is it possible with ffmpeg grab a window that is minimized or that not has the focus (there is another window over but ffmpeg records only the window which is below)?

With a command like ffmpeg -f x11grab -r 30 -i :0.0+x,y -f flv rtmp://url?

4

AFAIK it's not possible to capture a specific window with ffmpeg, the x11grab entry in the manual only refers to screens https://www.ffmpeg.org/ffmpeg-devices.html#x11grab and it suggests that the region you specify is static (if you move the window ffmpeg does not follow it):

However GStreamer offers some more flexibility in this case:

gst-launch-1.0 ximagesrc xid=0x04000007 ! videoconvert ! autovideosink

This works with out-of focus windows and you can even move them but it does NOT work with minimized windows.

As you may know, you can get the window id with wmctrl -l.

You can see the options supported by GStreamer elements using the gst-inspect-1.0 program, e.g.:

gst-inspect-1.0 ximagesrc
-1
  1. Use xwininfo to get window WxH and position (upper left corner)
  2. Start writing ffmpeg -f x11grab -video_size WxH -i :0.0+2,729 out.mp4
  3. CTRL + c it when you done
  4. Cut part you need (here it is from 00:00:06 to 00:00:16, no audio):
    ffmpeg -i out.mp4 -ss 00:00:06 -t 00:00:10 -an -c:v copy cut.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.