Screen capture in Linux (Ubuntu)

I wonder if there is code to copy that would help to capture screens of webcams, not the computer screens on desktop. I don't need individual snapshots, I need the whole dynamic process.

Thanks, - AlexBB
So you want to capture video from an actual camera?

Yes, there are libraries for this. There are also many programs that are under various free licenses that would do the job. You can look at their code and see what they are using (Though many fully fledged projects like that are going to be mixed language, or tend to use GObject which I just find frustrating)

A quick search for libraries landed me on openCV (Computer Vision) which is used for capturing video meant to be processed by the computer for motion tracking and AI uses. Tutorial: https://www.opencv-srf.com/2017/12/play-video-from-file-or-camera.html

VXL - similar idea to openCV, useful if your program is going to do some heavy processing on each image. Tutorial: Uh, there's an entire book, didn't find a short and simple tut. https://vxl.github.io/

Video4Linux2 - used by many programs on linux like ffmpeg, mplayer, skype (larger list here https://en.wikipedia.org/wiki/Video4Linux) Tutorial: http://jwhsmith.net/2014/12/capturing-a-webcam-stream-using-v4l2/

Qt also has a webcam interface if you want video/picture and don't care too much about the overhead of the Qt framework itself. Tutorial: https://www.youtube.com/watch?v=aGubFhk_ALs


Last edited on
probably work better if you search stream capture instead of screen capture :)

a lot of this will be done for you in hardware, I would think.
the process in a nutshell is:
capture a still frame, encode/compress it into a stream
but you should be able to get it as a stream from the device. Once you have the stream, a library should let you make a video file or pass it on as a stream over a network or just display and discard, etc. Are you wanting to post-process or just save/display/forward the stream?
Thank you guys. I really appreciate it. Very helpful. So far I've used MFCaptureD3D project in MS C++ at Github but I really want to do it in Linux. MS C++ is too hard for me :-)

- AlexBB
Topic archived. No new replies allowed.