That is an interesting use. However, as far as I know of, SJ4000 WiFi doesn't have built-in support for multi-camera setup, and it also have few limitations which could complicate attempts to set it up in that fashion, e.g. hard-coded IP address, and access point-only operation.
At a glance, doing this would...
Require a lot of hardware: either multiple wireless LAN cards, or multiple laptops/phones, one to connect to each camera, and...
Require network trickery similar to ones described in 0.7.0 Appendix D and...
Require you to control each camera individually: there's no command that would automagically make all cameras shoot together- you must send shoot command to all cameras at the same time instead.
In version 0.8.0 of the guide, I will discuss this usage in depth. In the meantime, I will update this thread to list possible/tested procedure for setting up multi-camera control as my experiment goes.
So, thanks for asking. And, if you like, stay tuned for experiment results.
Last edit: Nutchanon Wetchasit 2017-03-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, first of all thank you for your great job, this is really useful.
I'm trying to trigger multiple cameras (6) at the same time (I'm not using the SJ4000 but a similar one based on the same Novatek chipset) with a raspberry.
At this time I have five ways to explore:
1) Use one wifi adapter, switch 6 networks one by one and send commands (it takes 25-30 seconds to take 6 pictures, one for each camera)
2) Use six wifi adapters, set a tricky network configuration and send commands simultaneously (it is the expensive way)
3) Use 1 or 2 wifi adapter that support the creation of virtual interfaces (https://wireless.wiki.kernel.org/en/users/documentation/iw/vif). It seems a convenient solution but I can't find an adapter that is explicitly compatible
4) Use micro servos to manually push the button simultaneously (can be expensive and I would rather avoid mechanical solutions)
5) Find a way to take a picture using a usb or hdmi cable (I found the official cable http://sjcamhd.com/sjcam-sj6-legend-pwm-cable-for-aerial-fpv-has-arrived/ that seems really simple to built but I haven't tied anymore). I think this one can be the most simple and inexpensive way (building the cable :))
How are your experiments going?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, first of all thank you for your great job, this is really useful.
I'm trying to trigger multiple cameras (6) at the same time (I'm not using the SJ4000 but a similar one based on the same Novatek chipset) with a raspberry.
At this time I have five ways to explore:
1) Use one wifi adapter, switch 6 networks one by one and send commands (it takes 25-30 seconds to take 6 pictures, one for each camera)
2) Use six wifi adapters, set a tricky network configuration and send commands simultaneously (it is the expensive way)
3) Use 1 or 2 wifi adapter that support the creation of virtual interfaces (https://wireless.wiki.kernel.org/en/users/documentation/iw/vif). It seems a convenient solution but I can't find an adapter that is explicitly compatible
4) Use micro servos to manually push the button simultaneously (can be expensive and I would rather avoid mechanical solutions)
5) Find a way to take a picture using a usb or hdmi cable (I found the official cable http://sjcamhd.com/sjcam-sj6-legend-pwm-cable-for-aerial-fpv-has-arrived/ that seems really simple to built but I haven't tied anymore). I think this one can be the most simple and inexpensive way (building the cable :))
How are your experiments going?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1) Use one wifi adapter, switch 6 networks one by one and send command
I have to admit that I haven't thought of SSID hopping yet (probably because I have only one camera). Unfortunately for the same reason, I cannot do any experiment/test on this particular technique to improve the response time either.
3) Use 1 or 2 wifi adapter that support the creation of virtual interfaces
Yes, I thought of using multi-channel wireless LAN card too (since that would be the ideally easiest+cheapest way). But I, too, haven't personally heard of, or laid my hand on any model with that capability yet; so I left that area untested.
4) Use micro servos to manually push the button simultaneously (can be expensive and I would rather avoid mechanical solutions)
Interesting, haven't tried that one yet (lack of equipments, both servo and solenoid); could work well as a last-ditch solution for any camera model that is stationed still when construction is good enough. But that's not in my work's scope though :)
5) Find a way to take a picture using a usb or hdmi cable
As far as I know, from from a look at SJ4000 WiFi PCCamera mode's USB descriptor and Video4Linux information using my firmware version, it does not seem to provide separate support for photo shooting (maybe it's Linux's USB Video driver not supporting a still-photo mode, but a try on Windows XP seems to give the same result).
So, doing it this way would limit the resolution to 1280x720 (HD-ready 1MP 16:9) in both photo and video, but should interoperate nicely with off-the-shelf software via webcam interface; if you don't mind the wire and the resolution of course.
SANE's scanimage should work well for taking photo in this case (though you still have to convert to JPEG manually or use something akin to "scanimage -d v4l:/dev/video1 --mode color | convert pnm:- output.jpg"). If you have GNU/Linux desktop running somewhere, you can use GNOME Cheese program or Guvciew to test it as well.
If you are going to capture via HDMI, resolution limit will be lifted to 1920x1080 (HD 2MP 16:9) in both photo and video, but that requires HDMI VIVO/capture card; so it is largely out of the scope of my experiment.
My SJ4000 WiFi's USB descriptor and Video4Linux information obtained in PCCamera mode are listed below for reference:
# lsusb -v -d 0603:8612
Bus 003 Device 003: ID 0603:8612 Novatek Microelectronics Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0603 Novatek Microelectronics Corp.
idProduct 0x8612
bcdDevice 0.10
iManufacturer 1 NOVATEK
iProduct 2 J1455
iSerial 0
bNumConfigurations 1
Couldn't get configuration descriptor 0, some information will be missing
Couldn't get configuration descriptor 0, some information will be missing
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0001
Self Powered
# v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
Driver name : uvcvideo
Card type : J1455
Bus info : usb-0000:00:14.0-1
Driver version: 3.2.63
Capabilities : 0x04000001
Video Capture
Streaming
Format Video Capture:
Width/Height : 1280/720
Pixel Format : 'MJPG'
Field : None
Bytes per Line: 0
Size Image : 460800
Colorspace : Unknown (00000000)
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 1280, Height 720
Default : Left 0, Top 0, Width 1280, Height 720
Pixel Aspect: 1/1
Video input : 0 (Camera 1: ok)
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
If you use a different camera model, the resolution (and frame rate) might be different.
Last edit: Nutchanon Wetchasit 2017-06-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
2) Use six wifi adapters, set a tricky network configuration and send commands simultaneously
This is exactly where most of my experiments explore. To date, I have tested few possible configurations despite a limitation in number of equipments (I have only one SJ4000 WiFi); so following posts are more or less an abridged version of corresponding parts in current 0.8.0 draft.
All of my configurations below assume PC as a central machine, controlling 2 cameras (since writing a diagram of 6 would be really messy). Hope you don't mind ASCII art drawings...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The idea is using multiple wireless LAN cards to connect to each camera (one per camera); quite similar to non-networked camera uses. While I tested this configuration with a single camera (as Camera 1), I'm confident that it will work with two and more.
Hardware requirements:
1 Control PC
2 Wireless LAN card (or one card per camera)
Configuration requirements:
Static route
IPtables 1:1 NAT
Policy routing
Pros/cons:
All camera functions should work.
Only single machine is needed.
Complicated to configure, limits OS choice of the control machine.
Note: Both wireless LAN cards are set to use the same IP address.
PC configuration command (run as root, WLAN association/security configuration not included):
ip address replace 192.168.1.5/24 dev wlan0
ip route del 192.168.1.0/24 dev wlan0
ip route add 192.168.1.128 dev wlan0
iptables -t mangle -A OUTPUT -d 192.168.1.128 -j MARK --set-mark 128000
iptables -t nat -A OUTPUT -d 192.168.1.128 -j DNAT --to-destination 192.168.1.254
ip rule add fwmark 128000 table 128000
ip route add default dev wlan0 table 128000
ip address replace 192.168.1.5/24 dev wlan1
ip route del 192.168.1.0/24 dev wlan1
ip route add 192.168.1.129 dev wlan1
iptables -t mangle -A OUTPUT -d 192.168.1.129 -j MARK --set-mark 129000
iptables -t nat -A OUTPUT -d 192.168.1.129 -j DNAT --to-destination 192.168.1.254
ip rule add fwmark 129000 table 129000
ip route add default dev wlan1 table 129000
Once configured, you should be able to connect to each camera on the remapped address at 192.168.1.128 and 192.168.1.129, and do stuff.
To add another camera, duplicate the second block of command, add 1 to all wlan1s, add 1 to all .129s, and add 1000 to all 129000s. For the fourth camera and so on, just repeat the addings accordingly.
Next: One control machine, multiple gateways...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The point of this one is: sometimes you don't have wireless LAN cards to spare (which currently, I don't), but is able to use or borrow laptops to do your bidding. Again, I tested this with one camera and one laptop, though I'm confident that it will work on two and more.
Hardware requirements:
1 Control PC
2 Gateway laptop (or one per camera) with one wireless LAN card and one wired LAN card.
1 Ethernet switch
Configuration requirements:
Static route (on each gateway machine)
IPtables 1:1 NAT (on each gateway machine)
ARP proxy (on each gateway machine)
Pros/cons:
All camera functions should work.
Slightly less weird configuration.
Needs multiple machines, a separate wired network, and switch.
The control machine can use any OS, but gateway machines' OS choice is still limited.
Laptop 1 GNU/Linux configuration command (run as root, assuming WLAN association/security configuration is already done):
ifconfig wlan0 192.168.1.12 netmask 255.255.255.0
route del -net 192.168.1.0 netmask 255.255.255.0 dev wlan0
route add 192.168.1.254 dev wlan0
route add 192.168.1.128 dev wlan0
iptables -t nat -A PREROUTING -i eth0 -d 192.168.1.128 -j NETMAP --to 192.168.1.254
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.conf.wlan0.proxy_arp=1
arp -i eth0 -Ds 192.168.1.128 eth0 pub
Then use the same command for Laptop 2, but add 1 to all .12s, and add 1 to all .128s. In case you would like to add more cameras (and laptops), increase the addings accordingly.
Once configured, you should be able to connect to each camera on the remapped address at 192.168.1.128 and 192.168.1.129 to do stuff.
Next: Untested ideas...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
However, a sure-fire way to get multi-camera setup to work on all-Windows configuration would be to use following technique: I personally tested it with one camera as usual, but with both GNU/Linux and Windows XP...
Single control machine, multiple port-forwarding machines
Hardware requirements:
1 Control PC
2 Gateway laptop (or one per camera) with one wireless LAN card and one wired LAN card.
1 Ethernet switch
Pros/cons:
Simple configuration.
Needs multiple machines, a separate wired network, and switch.
Machines involved here can use any OS.
The wired network can use any address range (as long as it's not conflicting with 192.168.1.0/24)
From hardware side, it is the same as "Single control machine, multiple gateway machines". But from software perspective, wired and wireless networks here remain separate; which this approach relies on TCP relay software running on each laptop to forward connections it receives from control PC to the corresponding ports on the camera.
These are the list of TCP ports on laptop that you would need to forward to 192.168.1.254:
80 (file access/commands)
554 (live video feed)
3333 (push notification stream)
8192 (viewfinder feed)
If you are running Microsoft Windows on each laptop, you could use IP Relay as the TCP relay software; which comes with both command line and graphical variant. Configuring the graphical version should be easy enough; but if you use the command line version, start following commands on each laptop (each line in separate Command Prompt):
Once forwarders are up and running, you could connect to each camera by simply connecting to each laptop's wired LAN IP address. And if you use live video feed, don't forget to configure your media player to run the stream in TCP "RTSP/RTP interleaved" mode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2022-08-31
Hello Nutchanon! Thank for your share abd your hard work. I'm newbie and looking for a way to connect AND control(shutter at the same time) multi action camera. I'm newbie and could you share a link or more detail, which I can learn detail?
Thank you very much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Can I program it to trigger multiple SJCAM SJ4000 Camera at once
That is an interesting use. However, as far as I know of, SJ4000 WiFi doesn't have built-in support for multi-camera setup, and it also have few limitations which could complicate attempts to set it up in that fashion, e.g. hard-coded IP address, and access point-only operation.
At a glance, doing this would...
In version 0.8.0 of the guide, I will discuss this usage in depth. In the meantime, I will update this thread to list possible/tested procedure for setting up multi-camera control as my experiment goes.
So, thanks for asking. And, if you like, stay tuned for experiment results.
Last edit: Nutchanon Wetchasit 2017-03-21
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hello, first of all thank you for your great job, this is really useful.
I'm trying to trigger multiple cameras (6) at the same time (I'm not using the SJ4000 but a similar one based on the same Novatek chipset) with a raspberry.
At this time I have five ways to explore:
1) Use one wifi adapter, switch 6 networks one by one and send commands (it takes 25-30 seconds to take 6 pictures, one for each camera)
2) Use six wifi adapters, set a tricky network configuration and send commands simultaneously (it is the expensive way)
3) Use 1 or 2 wifi adapter that support the creation of virtual interfaces (https://wireless.wiki.kernel.org/en/users/documentation/iw/vif). It seems a convenient solution but I can't find an adapter that is explicitly compatible
4) Use micro servos to manually push the button simultaneously (can be expensive and I would rather avoid mechanical solutions)
5) Find a way to take a picture using a usb or hdmi cable (I found the official cable http://sjcamhd.com/sjcam-sj6-legend-pwm-cable-for-aerial-fpv-has-arrived/ that seems really simple to built but I haven't tied anymore). I think this one can be the most simple and inexpensive way (building the cable :))
How are your experiments going?
Hello, first of all thank you for your great job, this is really useful.
I'm trying to trigger multiple cameras (6) at the same time (I'm not using the SJ4000 but a similar one based on the same Novatek chipset) with a raspberry.
At this time I have five ways to explore:
1) Use one wifi adapter, switch 6 networks one by one and send commands (it takes 25-30 seconds to take 6 pictures, one for each camera)
2) Use six wifi adapters, set a tricky network configuration and send commands simultaneously (it is the expensive way)
3) Use 1 or 2 wifi adapter that support the creation of virtual interfaces (https://wireless.wiki.kernel.org/en/users/documentation/iw/vif). It seems a convenient solution but I can't find an adapter that is explicitly compatible
4) Use micro servos to manually push the button simultaneously (can be expensive and I would rather avoid mechanical solutions)
5) Find a way to take a picture using a usb or hdmi cable (I found the official cable http://sjcamhd.com/sjcam-sj6-legend-pwm-cable-for-aerial-fpv-has-arrived/ that seems really simple to built but I haven't tied anymore). I think this one can be the most simple and inexpensive way (building the cable :))
How are your experiments going?
@cremby,
I have to admit that I haven't thought of SSID hopping yet (probably because I have only one camera). Unfortunately for the same reason, I cannot do any experiment/test on this particular technique to improve the response time either.
Yes, I thought of using multi-channel wireless LAN card too (since that would be the ideally easiest+cheapest way). But I, too, haven't personally heard of, or laid my hand on any model with that capability yet; so I left that area untested.
Interesting, haven't tried that one yet (lack of equipments, both servo and solenoid); could work well as a last-ditch solution for any camera model that is stationed still when construction is good enough. But that's not in my work's scope though :)
As far as I know, from from a look at SJ4000 WiFi PCCamera mode's USB descriptor and Video4Linux information using my firmware version, it does not seem to provide separate support for photo shooting (maybe it's Linux's USB Video driver not supporting a still-photo mode, but a try on Windows XP seems to give the same result).
So, doing it this way would limit the resolution to 1280x720 (HD-ready 1MP 16:9) in both photo and video, but should interoperate nicely with off-the-shelf software via webcam interface; if you don't mind the wire and the resolution of course.
SANE's
scanimage
should work well for taking photo in this case (though you still have to convert to JPEG manually or use something akin to "scanimage -d v4l:/dev/video1 --mode color | convert pnm:- output.jpg
"). If you have GNU/Linux desktop running somewhere, you can use GNOME Cheese program or Guvciew to test it as well.If you are going to capture via HDMI, resolution limit will be lifted to 1920x1080 (HD 2MP 16:9) in both photo and video, but that requires HDMI VIVO/capture card; so it is largely out of the scope of my experiment.
My SJ4000 WiFi's USB descriptor and Video4Linux information obtained in PCCamera mode are listed below for reference:
If you use a different camera model, the resolution (and frame rate) might be different.
Last edit: Nutchanon Wetchasit 2017-06-19
This is exactly where most of my experiments explore. To date, I have tested few possible configurations despite a limitation in number of equipments (I have only one SJ4000 WiFi); so following posts are more or less an abridged version of corresponding parts in current 0.8.0 draft.
All of my configurations below assume PC as a central machine, controlling 2 cameras (since writing a diagram of 6 would be really messy). Hope you don't mind ASCII art drawings...
Single control machine, multiple WLAN cards
The idea is using multiple wireless LAN cards to connect to each camera (one per camera); quite similar to non-networked camera uses. While I tested this configuration with a single camera (as Camera 1), I'm confident that it will work with two and more.
Hardware requirements:
Configuration requirements:
Pros/cons:
Diagram:
Note: Both wireless LAN cards are set to use the same IP address.
PC configuration command (run as root, WLAN association/security configuration not included):
Once configured, you should be able to connect to each camera on the remapped address at 192.168.1.128 and 192.168.1.129, and do stuff.
To add another camera, duplicate the second block of command, add 1 to all
wlan1
s, add 1 to all.129
s, and add 1000 to all129000
s. For the fourth camera and so on, just repeat the addings accordingly.Next: One control machine, multiple gateways...
Single control machine, multiple gateway machines
The point of this one is: sometimes you don't have wireless LAN cards to spare (which currently, I don't), but is able to use or borrow laptops to do your bidding. Again, I tested this with one camera and one laptop, though I'm confident that it will work on two and more.
Hardware requirements:
Configuration requirements:
Pros/cons:
Diagram:
Laptop 1 GNU/Linux configuration command (run as root, assuming WLAN association/security configuration is already done):
Then use the same command for Laptop 2, but add 1 to all
.12
s, and add 1 to all.128
s. In case you would like to add more cameras (and laptops), increase the addings accordingly.Once configured, you should be able to connect to each camera on the remapped address at 192.168.1.128 and 192.168.1.129 to do stuff.
Next: Untested ideas...
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hello! does this run on windows machines to?
No, all commands I mentioned above are for GNU/Linux.
As far as I know, Microsoft Windows does not support policy routing, so the method that uses only single machine would be out of the question. For the other method, using Windows will definitely be difficult too.
However, a sure-fire way to get multi-camera setup to work on all-Windows configuration would be to use following technique: I personally tested it with one camera as usual, but with both GNU/Linux and Windows XP...
Single control machine, multiple port-forwarding machines
Hardware requirements:
Pros/cons:
Diagram:
From hardware side, it is the same as "Single control machine, multiple gateway machines". But from software perspective, wired and wireless networks here remain separate; which this approach relies on TCP relay software running on each laptop to forward connections it receives from control PC to the corresponding ports on the camera.
These are the list of TCP ports on laptop that you would need to forward to 192.168.1.254:
If you are running Microsoft Windows on each laptop, you could use IP Relay as the TCP relay software; which comes with both command line and graphical variant. Configuring the graphical version should be easy enough; but if you use the command line version, start following commands on each laptop (each line in separate Command Prompt):
If one is running GNU/Linux or other Unix-like system on each laptop, they could use Socat. Run these commands on each laptop, as root:
Once forwarders are up and running, you could connect to each camera by simply connecting to each laptop's wired LAN IP address. And if you use live video feed, don't forget to configure your media player to run the stream in TCP "RTSP/RTP interleaved" mode.
Hello Nutchanon! Thank for your share abd your hard work. I'm newbie and looking for a way to connect AND control(shutter at the same time) multi action camera. I'm newbie and could you share a link or more detail, which I can learn detail?
Thank you very much.