rodizio1 / EZ-WifiBroadcast

Affordable Digital HD Video Transmission made easy!
GNU General Public License v2.0
817 stars 200 forks source link

Video switching patch from user htcohio #135

Closed rodizio1 closed 5 years ago

rodizio1 commented 6 years ago

https://www.rcgroups.com/forums/showpost.php?p=39867908&postcount=4932

https://drive.google.com/file/d/1vHvJlccpbVlma0mXGT332akWsoPuuQH3/view

careyer commented 6 years ago

This is awesome! However, this solution occupies one of the already very limited 8 MavLink channels. It would make a whole lot of sense to expand the 8 proportiol channels (MavLink) with a number of additional switching channels (e.g CH9-12 maybe even CH9-16) which can either control GPIOs (On-Off) or can be interpreted in the WBC-loop to trigger additions in the code (e.g. switch between different OSD screens, trigger a python script, switch multiple cameras etc...) The benefit of this would be unlimited. Right now the only limitation of EZ-WBC is the 8Ch limitation which results from the MavLink override channels mimik. It would be awesome if Rodizio could overcome this by sending more channels to the air which do not nessesary need to be mavlink channels.

htcohio commented 6 years ago

User1321 is the one who actually came up with the code to get this working as is. I agree, the possibilities would be endless if this could be figured out. You would be able to remotely trigger various video or other functions from the ground remotely including data rate and FEC settings. Could require a reboot while in the air but if you're pushing distance at data rate 3 you could switch to data rate 2 for instance.

rodizio1 commented 6 years ago

Changing wifi bitrate on-the-fly would also be possible, with Atheros cards this would require changes to the kernel drivers and maybe also Atheros firmware, as well as to raspivid.

With Ralink and Realtek it's easier, they already support to set wifibitrate on a per-packet basis from userspace (i.e. tx_rawsock).

Another easier to implement option would be changing the bitrate with iw/iwconfig and then re-starting raspivid, but that would probably take about 1-3 seconds which sucks in my opinion.

matiaspl commented 6 years ago

For the record - gstreamer's gst-rpicamsrc https://github.com/thaytan/gst-rpicamsrc allows live bitrate switching

htcohio commented 6 years ago

The primary advantage of changing Wi-Fi bitrate on the Fly is that you can receive video at lower and lower noise floor levels (i.e.) greater range. That's my understanding at least...

So at data rate of 4 video starts to break up around -84 dbm.

Data rate 3 starts around -87dbm

Data rate 2 starts around -90dbm

(These are just rough approximation based on my memory so they could be off a little bit.

JamesCordell commented 6 years ago

The raspivid does support variable bitrate but I think it adapts based on the image complexity and may not be "commanded to switch on an adhoc basis". I'll look at this.