CamRecord - ffmpeg-based webcam recording utility. Permits simultaneous operations with multiple cameras...
Afternoon, gang.
Following on from MultiCam - and with invaluable assistance from @greengeek - this is the culmination of what I first set out to achieve, some 5 years ago.
Having for several years had a collection of webcams kicking around underfoot, it was @rockedge 's experimentation with / usage of ZoneMinder that got me thinking; there had to be a way to do something similar with ordinary webcams. I couldn't be the only one with spares gathering dust & cluttering-up the place! I began half-heartedly tinkering with various ideas.....though at THAT time, I knew darned well my scripting skills weren't up to the job.
So I bided my time, and continued to hone/improve upon what skills I did have. "Practice makes perfect", as they say.....and it does!
For me, at least, my scripting journey has been a steadily-accelerating one. You start off with very basic stuff, experimenting with examples you find on-line until you get the hang of what's going on. You then try adding more than one thing into the same script, just to see what happens.....over time, the process accelerates until you're not only implementing the now considerable range of things you've already learnt, you're also still adding-in new stuff 'on-the-fly' as you go along...
But enough of this cogitating. Here, mes amis, is
CamRecord
.......currently at v1.1, since my perfectionism won't permit me to release stuff until I'm already happy with it.
(*shrug*)
-----------------------------------
I've always shied away from ffmpeg in the past, 'cos it is SO bloody complicated. The permutations are almost endless, and it's ultra-fussy about everything being just so; every 't' must be crossed, every 'i' has to be dotted, all must be in precisely the right order or it throws tantrums like a 3-year old.
MultiCam would do what I wanted - sort of. It would display multiple cams, it would record from them.....though I couldn't figure out how to make mPlayer show a 'preview' of what it was recording WHILE it was recording it.
greengeek has been working away on similar stuff for a while now. We've bounced ideas off each other, swapped tips and bits of code. With his latest 'project' - UsbCamCord - he's switched to experimenting with ffmpeg. I believe he found some of what worked for him on StackOverflow; which is coincidental, because I too have found answers to no end of my own wee issues over there for years.
I'd managed to figure out most of what I needed after several hours of research & experimenting, but one bit still eluded me.....which I found in Ian's script. I 'borrowed' a stanza, and researched it further; turned out there are several ways of implementing this same function, but none of it is particularly intuitive. Anyway, I've cobbled together something that works for me; works better than I expected, actually. I found out just this morning that it was already capable of doing stuff that I feared would mean even more modifications, but instead existing functions just need implementing in slightly different ways.
Which I'm quite chuffed with....
-----------------------------------------------------
The main GUI looks like this; quite simple, and understated:-
Set-up your 'Sources' first. This is required on the first run to 'initialize' things. Work your way through the various mini-GUIs; some have 'checker' scripts that run in the terminal - primarily audio cards & cams - so you can see what you've got, and what you'll need to select. Framerate and resolution are self-explanatory. Close all these when finished.
Then bring up the 'Media Controls':-
The 'Live feed' is exactly what it says, no more, no less. This is just a live, real-time stream; nothing is being recorded here.
If you choose to record, you get the choice of either video-only, OR video & audio. Hit the 'STOP' button when you want to quit. 'Play' lets you review your recording, and is set to use your default media player. If you're happy with it, you can then choose to 'Save'. (Or not....)
I will say here and now that I'm not certain whether the audio component will work with the newest Woof-CE built Puppies that employ PulseAudio by default. I don't run these, apart from occasional excursions with KLV 'Airedale'; I loathe PulseAudio - despite its apparent popularity - and I avoid it as much as I possibly can. I know ALSA is still the 'backend', even for PA, but I don't know if the system will let you access it directly like CamRecord does....
I've chosen to default on the Matroska (.mkv) container for this. Experimenting has shown this to give the best combination of recording/playback quality with the smallest file-size.
The 'Help' file can be found via the 'About/Help' button.
----------------------------------------------
If you wish to perform more than one operation at a time, set the first one going. While this is running - and the GUI is still open - go into 'Sources' again, choose the camera you want & set up the required parameters again. Now select the required operation, and set your second camera to work.....
CamRecord-portable remembers the last selection of settings that you chose.
When more than one operation is running at the same time, you should quit the one you want by closing the window instead. Don't use the 'Stop' button, because
Code: Select all
killall ffmpeg
.....will stop everything!
--------------------------------------------------
Some of the commands here require a fairly up-to-date build of ffmpeg, due to the way in which they're implemented. Anything from Fossapup64 9.5/9.6 onwards should work natively. However, CamRecord will work quite happily in Puppies as far back as Tahrpup by the use of John van Sickle's 'static' ffmpeg builds.
https://johnvansickle.com/ffmpeg/
Testing has shown that v5.1.1, at the top of the 'old-releases' page (still very recent) seems to be the best all-rounder for this. The very newest build has some odd 'quirks' in it that preclude its usefulness here.
Recommended procedure is as follows:-
Download the appropriate build of v5.1.1. If you run both arches of Puppies, like me, you'll want both builds.
Unzip the tarballs, then move the appropriate 'ffmpeg' binary into either /initrd/mnt/dev_save OR /mnt/home, depending on how your Puppy has been built. Rename it to either 'ffmpeg32' OR 'ffmpeg64' as required. This keeps it outside the 'save'.
Within the /CamRecord/FUNC/SOURCES/FFMPEG directory, you'll find 3 scripts. Two of then will link either the 32-bit static or the 64-bit static into CamRecord at the location where it looks for it. The third simply removes this link if not needed (again, depending on your Puppy).
When running camera operations, the scripts will first check for the presence of this sym-linked binary. If they find it, they will use it. It it's not present, they will default to using the built-in system version of ffmpeg. Older Pups - Bionic and backwards - WILL need to use this static ffmpeg with CamRecord, because the native versions just don't recognise half the commands in use.....quite a few of the older command equivalents have already been deprecated by the FFMPEG Project.
If anyone wishes to locate these 'statics' elsewhere in their system, you'll have to make the appropriate modifications yourselves. Sorry guys, but I'm not a mind-reader!
----------------------------------------
If anyone would like to take a look at this, y'all can find it here at my MediaFire a/c:-
https://www.mediafire.com/folder/vctx2u ... /CamRecord
This is 'no-arch', and will run under any Puppy; the only arch-specific item required is ffmpeg itself. The usual scripts will permit adding to/removing from the main Menu if required.
Hope this proves useful to some of you. Enjoy.
Mike.