Having got one of these devices to take data from my security cameras, I decided to come up with a solution that would let use all 4 inputs to some degree. While the existing somagic-capture program could do this (limiting frame count), executing it multiple times per second seemed less than ideal, and I was hoping for better results (faster switching) by having the program do it.
I have something that works - I need to do some cleanup, but example is:
somagic-capture4 -n --drop-frames 5 --sync-frames 4 --save-frames 3 --vo=/tmp/test-%d.raw -i 1 -i 2
The --save-frames is how many frames it captures from one source before going on to the next. The output file can now include a %d option to have the files named unique (one could have the different inputs all go to the same file, in which case you just see the switching happen as you watch). There are 2 input options (-i) - those are the inputs to cycle between. I expect it will work fine with 4, just my test environment only has 2 convenient sources.
It would probably be nice to have some way to fix/detect the no video input, as it would be somewhat annoying to lose data from all 4 sources (due to program not doing anything as it waits for input) if one camera/cable fails.
--drop-frames is how long the program delays (usleep()) after switching inputs - this is time for the easycap device to better sync with the next input.
--sync-frames is how many frames that somagic-capture4 will process but not saving, in order to properly get its video state synced up. I only modified the alg2_process section, since I'm using NTSC and that is what it uses.
The main change I made is in somagic_capture, in the libusb_handle_events() loop. Basically, we record last time the input was switched, and if the current
capture frame exceeds that + frame switch, I switch inputs with:
somagic_write_i2c(0x4a, 0x02, 0xc0 | cvbs_input);
In my testing, this seems to do what I want. I still need to figure out a good way to find all this to zoneminder. I'm also not sure best way to make these changes available - these changes should not affect operation when running somagic-capture in a single input configuration.
I'm also hardly an expert in USB protocol or video timings, so I'm not sure if there are other things I could be doing to get better results - namely, reduce the amount of frames being discarded/used for syncing after switching inputs. With needing ~10 frames to do that, it means that when using 4 inputs, this will be a pretty low frame rate, though I expect still fast enough for my purposes.