South Webcam Media Plugin¶
The plugin keeps on taking a video frame from directory or webcam and saves into a directory. It also appends the name of the saved files in the reading generated.
- ‘assetName’: type: string default: ‘WebcamImages’:
Name of Asset output.
- ‘mediaType’: type: string default: ‘directory’:
Source from which the media files are generated
- ‘mediaDir’: type: string default: ‘webcam’:
If the mediaType is camera then the directory where media will be stored. If the mediaType is directory then it is the name of directory inside FOGLAMP_ROOT/data where images are stored.
- ‘dataFormat’: type: enumeration default: ‘IMG’:
Format of files in ‘mediaDir’
- ‘repeatLoop’: type: boolean default: ‘false’:
If the mediaType is directory is reload when you hit the end playing the images from directory.
- ‘cameraNumber’: type: integer default: ‘0’:
Number associated with /dev/video in your file system. for example /dev/video0 then use 0.
- ‘fpm’: type: float default: ‘10.0’:
frames to save per minute.
Execution¶
To run the south webcam media plugin you can either
Copy some images inside some directory in FOGLAMP_ROOT/data. Let’s say the directory name is pics. Run the following command.
curl -sX POST http://localhost:8081/foglamp/service -d '{"name":"My_web_cam","type":"south","plugin":"webcam_media","enabled":true,"config":{"assetName":{"value":"WebcamImages"}, "imageDir":{"value":"pics"}, "mediaType":{"value":"directory"}, "fpm":{"value":"10.0"}}}' |
Connect a camera to the machine and run the following command.
$ v4l2-ctl --list-formats-ext --device /dev/video0 You will see something like 'YUYV' (YUYV 4:2:2) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 720x480 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 1280x720 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 1920x1080 Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.033s (30.000 fps) Size: Discrete 2592x1944 Interval: Discrete 0.067s (15.000 fps) Size: Discrete 0x0Now we know that the id 0 is functional. If no output then try 1,2,3 and so on.
Finally launch the plugin using
curl -sX POST http://localhost:8081/foglamp/service -d '{"name":"My_web_cam","type":"south","plugin":"webcam_media","enabled":true,"config":{"assetName":{"value":"WebcamImages"}, "imageDir":{"value":"webcam"}, "mediaType":{"value":"camera"}, "cameraNumber":{"value":"0"}, "fpm":{"value":"10.0"}}}' |jq