Afternoon, gang.
Now then... Am I the only one with a number of spare webcams kicking around? If you, too, have a bunch of these to spare, ever wondered what you could do with them? Well, here's summat to play around with....
Inspired by @greengeek 's MirrorCam and DrainCam thread, I decided it was time to take the bull by the horns, get off my lazy ass and finally attempt to crystallize an idea that had been knocking around the back of my (mostly) empty skull for quite a long time.....
So, here it is. Say hello to "MultiCam".
-----------------------------------------
Using Tahr32 as he is, Ian decided to use VLC as his display "engine", since it's installed in Tahrpup OOTB. I looked at what he'd done, had a think, did a bit of research.....and came to the conclusion that, for me at least, mPlayer was probably the better option since I have it in just about every Puppy, given that so many 'front-ends' are built on top of it.
Then it was time to get to the 'meat of the matter'. How would I command mPlayer to do what I wanted..? The documentation for mPlayer is copious, to say the least. In fact, it's humungous.....which is hardly surprising, given that folks have been working on it for well over 20 years. It's like a small stack of Bibles; there are hundreds & hundreds of pages relating to mPlayer, all accessible from their main home page. And when it comes to specifying parameters, it's easily the equal of ffmpeg; literally every parameter has to be individually specified via a 'switch'.
To tell the truth, I quickly got lost. So I did what I always do under these circumstances; perused the Arch Linux wiki (brilliant resource!) in search of some clarification.....and very soon, I had a starting point from which to work.
Both of us have used the v4l2 driver. It's part of the UVC (USB Video Class) standard, which has been in, and supported by the kernel for ages. Hence should be available to all Puppians.
--------------------------------------
That starting point involves the use of the "tv://" command, which mPlayer can use to display the output from one of these TV tuner dongles that are now readily available. However, it also works for webcams, and the Arch Linux wiki gave a handful of working examples to try out. One of these did exactly what I wanted; displayed the output from a webcam within an mPlayer window. Perfect!
Using two launch scripts, suitably modified for the appropriate "/dev/videoX" identifier, let me display the output from two webcams, simultaneously, side-by-side on screen. After that, I ran into a wall; trying to display a 3rd one only resulted in a "green screen". This may be related to hardware; specifically, the GPU in use. My discrete Nvidia card lets me display two at the same time (but NOT three); Ian ran into the wall when trying to display the second one. I also hit the wall on the second one when running this on my recent acquisition, the Dell Latitude lappie. Anyway, being able to do stuff with at least two cams simultaneously proved the principle was workable, so that's what MultiCam currently does.
Then, it was time to think about capturing some of this output. By this time, I was beginning to be able to navigate my way around mPlayer's documentation, so some trials commenced (with help from the Arch wiki, again). This is, by necessity, a bit more complex; not only do you need to specify the video identifier for each camera, you also need to specify the audio input for whatever device you wish to record audio from, by running
Code: Select all
arecord -l
.....in a terminal, to list all capture devices attached to your system. And the "fun" doesn't stop there! mPlayer - like XVidCap, the screen capture app - uses the older OSS terminology; "/dev/audio'x'" instead of "hw:'x'" as given by ALSA.....because it dates back to the days when every piece of hardware on Linux was ALWAYS "/dev/something-or-other". And the devs have stuck with this, because you still find all this info in the /dev directory if you take a peek. Fortunately, the numbers always correspond, so it's just a matter of 'translating' the command, and substituting the appropriate device number.
-----------------------------
When selecting to record, a wee toolbar pops-up for each cam. You can 'Record', then 'Stop'. You can then 'Play' it back, and if satisfied, you can 'Save' the file. The only snag is that there's no way to add a 'monitor' display, so that you can see what you're recording; leastways, I cannot figure out how to achieve this. I'm not entirely certain whether mPlayer CAN record AND playback simultaneously, if I'm honest.
Recording does at least work; you just can't monitor it. Saving will save to a sym-linked directory in /root, called "MultiCam"; this is sym-linked in from the portable directory while the app is running; at close, that sym-link is removed.
I don't know of a way to make mPlayer record two streams at the same time.....so please don't ask!
------------------------------
I'm making this available at its present stage of development. It's functional, and usable. You WILL need to edit the various scripts to add your own device identifier numbers for audio and video. Two buttons on the GUI will let you identify video/audio devices; " Video* " lets you see what the /dev/video number is for each camera, and " Audio* " lets you identify your preferred audio source.
In the portable directory:-
/DATA/MEDIA/Cap1/Record is what you will need to edit for Camera 1's appropriate video/audio device numbers.
/DATA/MEDIA/Cap2/Record will need editing for Camera 2.
------------------------------
If anyone's interested, you can find it here (it's just a little too big to attach):-
https://www.mediafire.com/folder/agj8tl2mctt8l/MultiCam
Same as always:-
Download
Unzip
Put it anywhere you like. Outside the 'save' is better, since you also store recorded videos here, too
Click to launch, 'cos it's a ROX-App. Rt-clk->Look inside to access the contents for editing scripts, etc.
You can add a Menu-entry if one is required via the usual, included scripts. You'll find it under Menu->Multimedia.
Have fun with it..!
Mike.