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}"

Sunday, February 16, 2014

PropertiesMapper - Java library to map java.lang.Properties to Object fields via annotations

I created a small java library called PropertiesMapper to map the values from java.util.Properties objects to abitrary java.lang.Object fields and vice versa using annotations and reflection. This is especially useful to populate your java objects with the contents of .properties files while maintaing a good code readability. For more information, see the git repository for PropertiesMapper. Code examples are available in the project's