FFMPEG & Avconv Command to Take PNG,JPEG Picture From Webcam in Command Line Full Tutorial For Beginners



Using avconv or ffmpeg, you can capture a frame from your device as well. For example:






This will open /dev/video0 as a video4linux2 compatible device, set up resolution to 640x480, stream for 2 seconds (00:00:02 or simply 2), then capture one single frame, saving it to /tmp/out.jpg.


Check if your device is /dev/video0, as it can be different for you.


The available resolutions depend on your webcam. Mine goes up to 640×480 and I checked it with a tool called qv4l2, which is used to configure a video4linux2 device.


The -ss parameter is used to allow the device to start up correctly. Here in my tests, there is a fade-in effect while the camera is being turned on, so, if I just omit -ss 2, the captured frame will be very dark.


Leave a Reply