-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworking of App #370
Comments
I'd like to take on the task of routing the live camera feed to the app. |
An update to this issue: I have successfully been able to stream video from my laptop's webcam (using python and openCV) to an android app over the internet and I believe this can be replicated with the BBB running python code to stream the video to the android app. However this is still under progress since there are various smaller issues that need to be resolved; the most important of them being the delay in displaying the video on the app (about a second). If anyone's done something like this before, I'd appreciate some ideas on how to minimize this delay. I will restrain from spilling all the technical details here for the sake of conciseness. |
I've done a lot of performance stuff generally, but nothing specific to video/streaming/Android/etc. Again, just generally speaking, the first step is to quantitatively describe the sources of the delay. Which steps of the stack are taking a long time? What resource are they short on (CPU, RAM, HDD/SDD backing store, network throughput, network latency, ...)? Fix the lowest hanging fruit and re-measure. Hope that helps. If you give some of the relevant tech details, I might be able to help more. |
This is exactly the right place to spill all of the technical details :) |
@dfarrell07 That does help a lot. I'm going to run some tests later at different points in the stack to see which takes the most time. @AhmedSamara haha fair enough: So the stack goes like this Server side:
Client side:
I hope that this addresses most of the technical details. Now regarding the delay in the stream, I have two suspicions as to what could cause it:
|
Is the delay better on different wifi networks? As I understand it, the delay would probably happen at client.step 4, the I don't know if the delay is necessarily a thing we can solve in code (at Could you go ahead and post your code? (It doesn't matter if it's not done, On Tue, Jul 21, 2015 at 10:28 PM, Vijay Thiagarajan <
Ahmed Samara |
If you are not committed to the solution you are already using, my team working on the Firefighting Drone Challenge was able to stream video from a webcam, through the BBB, over wi-fi, last semester. We used gstreamer, and were able to tweak it to only a 300ms delay. That took about 40 hours to get up an running. Derek Molloy also lays out another way to do it in his book Exploring Beaglebone. |
@kvijay1995 - Super quickly, it sounds like there are quite a few RTTs (round trip times) per image frame. One RTT would typically be ~10-20ms at best (just latency, not counting throughput delay from the large image). |
@AhmedSamara I haven't tried it on different wifi networks so I wouldn't know if that's the reason. I'll look into IP cams and try to replicate their methodology. Ahmed the code is posted at https://github.com/kvijay1995/Video-Client and https://github.com/kvijay1995/Video-Server @PaladinEng I think this is the right time to be open to ideas so that would be great. I looked into gstreamer and it looks like both android and linux are supported so that's a good sign. Do you happen to know which video codec you guys used (h.264, mjpeg, etc.)?. I believe Derek Molloy uses v4l2 (Video4Linux2) in conjunction with avconv to stream video. That would be great if I can talk to your teammate; only problem is I won't be in for another 2 weeks but I can do anytime after. Would it be possible to meet him then? In the meantime I can do some more research about this. @dfarrell07 - Yes that's true; I'll try to eliminate those acknowledgement messages from the client and see if that helps. Thank you guys for your input! :) |
I am wondering what resolution and framerate are you sending the video over? Having a 1080/720 at 30fps is taxing. The question to ask then is, do we actually need this fidelity or can we use a lower quality? Changing these might help a bit. One possible way of lowering the latency is to reduce the payload of each packet. Sending big packets may be slower than sending many lesser packets. This can be done by Fragmenting/Splitting up each packet into a certain max size. A solution for removing step four as pointed out by Ahmed could be to merge the size of the jpeg and data together or just send them without the confirmation, as order in TCP is maintained (assuming the same connection). I think that the confirmation in step seven can also be discarded safely. Unless the confirmations are there for other precautions. |
@kennychuang Right now the resolution I'm sending over is 480p (640*480) and the framerate is not being controlled right now. I am planning to control the frame rate as we move forward however. I haven't looked into fragmenting the packets yet but for reference each image I'm sending right now is no more than 90,000 bytes. I'll try fragmenting too to see if it helps. I've already removed all of the confirmation messages as suggested by you, Ahmed and Daniel. I'll commit the revised code later tonight. Thanks for you input Kenny Here's the updated stack if anyone's interested:
Client side:
|
Can someone post an update for this? Its still an active and ongoing issue in real life but the Github issue is out of date @mynameis7 can you describe the issue you were seeing with the app? It looked really good the other night, but I remember it couldn't collect data? @kvijay1995 are you still having an issue with delay in video processing? |
Yea, there's still some delay in the video processing. From my talk with Alwyn, we came to a conclusion that there will always be a delay in this since the beagle bone hardware is not designed for realtime video processing. We can certainly optimize the video streaming process, but the question is how relevant or useful would this be for our end goals since this might turn out to be quite time consuming. |
I'm not sure I'd recommend that route. Packet size optimization for perf is a very complex problem, without quite a bit more background/study I think it's a poor use of time.
+1, it's about figuring out which properties you need (latency, jitter, throughput) and how optimized they need to be.
Very important question to keep in mind, it does smell a bit like a time sink/rabbit hole. |
It was discussed yesterday that we could benefit from having an app which could control the bot and also display a feed from a camera as well as the environment constructed from lidar.
Currently we have the framework of an app from previous years robots. The task is to take an modify this app to display this new information.
This task is included as an end of summer milestone goal
The text was updated successfully, but these errors were encountered: