Capturing Video via Mcode

Imagine you only want to capture a short video of a certain move instead of capturing everything. Would’t it be nice to just use an MCode, let’s say M199 P60 to record 60 seconds of video? Alright, no problem…

mencoder tv:// -tv driver=v4l2:width=640:height=480:outfmt=uyvy:device=/dev/video0:input=1:fps=15 -nosound -ffourcc DX50 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:turbo:vbitrate=1200:keyint=15 -endpos $param -o /tmp/cncrecord.avi < /dev/null >& /dev/null &

exit 0

This uses mencoder to capture from my webcam (Microsoft Kinect at the moment, I’ll shortly switch to a Logitech HDC270 due to better linux support) to the file /tmp/cncrecord.avi. Save this as M199 to your nc_files directory, adjust for your webcam. restart linuxcnc and you are good to go.

Leave a Reply