iltaf khalid
iltaf khalid

Reputation: 10318

motion detection VLCj

I am writing a webcam recording application using VLCj API. I need some help regarding motion detection in the video stream from the webcam. If there is no motion detected in the video stream, then recording shall stop.

I have tried to use the --video-filter=motion in sout chain but that didn't detected any motion.

My sout chain:

String[] options = {
                    ":sout=#transcode{vcodec=mp2v,vb=4096,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=" + fileName + "},dst=display,select=noaudio,video-filter=motion} --video-filter=motion",":input-slave=alsa://hw:0,0"  };

Looking forward to your response. Thanks in advance.

Upvotes: 5

Views: 2132

Answers (1)

ecle
ecle

Reputation: 4000

You pass the VLC command option string array incorrectly; it should be as in following example (each VLC command option should treated as an array element):

String[] options = {
    ":rtsp-mcast", 
    ":sharpen-sigma=2.0", 
    ":video-filter=motion",
    ":blur-factor=127", 
    ":ipv4-timeout=3000", 
    ":no-video-title-show", 
    ":loop", 
    ":sout-all",
    ":sout-keep"
};

The option string below won't work since two VLC commands are included together into one String; the :sout command and the --video-filter=motion command:

":sout=#transcode{vcodec=mp2v,vb=4096,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=" + fileName + "},dst=display,select=noaudio,video-filter=motion} --video-filter=motion"

It should be as follows:

":sout=#transcode{vcodec=mp2v,vb=4096,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=" + fileName + "},dst=display,select=noaudio,video-filter=motion}",
"--video-filter=motion"

Upvotes: 3

Related Questions