Monday, February 24, 2014

Capture a video from a webcam using vlc (cvlc) and dump a frame grap image periodically on a linux server

Use this if you want to capture a video from a webcam while dumping a frame grap image periodically every 300 frames. This way you can still upload a plain old webcam image to your webserver without losing the ability to capture a higher framerate video at the same time. Webcam settings are set in the v4l2-url at the beginning. I am not really sure about the mkv file name ending or if the video is already in a mkv container, but that's not the point here. Note that the image is roateted by 180 degrees in this example. This all works in a linux console without X. The parameters should be similar for other OS than Linux, though.
cvlc v4l2:///dev/video0:width=640:height=480:fps=30 --noaudio --sout '#transcode{vcodec=h264,acodec=none,vb=4096}:file{dst=output.mkv}}' --sout-transcode-vfilter="rotate{angle=180}:scene{path=scene/,prefix=out,ratio=300,replace}"

No comments:

Post a Comment