0

I've been looking for a way to get Pi Cam video streaming into an Android device and all Android Source code I found is very high latency. The only one I found was the ShawnBaker´s RPiCameraViewer app that works very well with very low latency. The only problem is that this code is very confusing and full of Libs, Activity, and complexity. I ask someone to help me to get this job done with the minimum code. Just the SurfaceView playing from a raspberry UDP video server.

My goal is have a Android code to stream Raspberry cam whith low latency.

The comand I use is:

https://github.com/ShawnBaker/RPiCameraViewer

raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | ncat -lkv4 5001

and the UDP variation:

raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | ncat -lv4 -u 5001

I had tried all kinds of players like Exoplayer and Vitamio without successful. Weeks looking. Any help?

  • You can use PiCamera (esay to understand because very well documented). In the doc, you can find usefull example of streaming HTTP server. The server is implemented on the RPi. You can set a lot of parameters , for examples, the most interesting for your network speed and processor usage: framerate . Then, on your Android open any programs called web-browser and navigate to your server , the movie is displayed in a simple html page in img tag. You can also use HTTPS for security. – Ephemeral Oct 26 '19 at 13:05
  • Raspivid provide only TCP and UDP layers with no encryption. Any android have web-browsers.The http/https solution is good because you do not need to code the client or install a third-party application. The example is here 4.10. Web streaming – Ephemeral Oct 26 '19 at 13:17
  • Since the Pi can stream raw H.264, perhaps you should search for Android interfaces based on that and not "raspberry pi"... – goldilocks Oct 28 '19 at 15:39
1

I don't know what you was exactly looking for but RPiCameraViewer application (the video streaming part of course) can be condensed to 4-5 classes and one library. If you don't need transition effects like fading controls, camera listing and so on, the interesting code is just split between the following files:

  • VideoFragment.java
  • SpsParser.java
  • SpsReader.java

You still need the ca.frozen.library because you need the ZoomPanTextureView component. Please note that this component is available here:

https://github.com/ShawnBaker/Library/blob/master/library/src/main/java/ca/frozen/library/views/ZoomPanTextureView.java

The remaining code of the original app is not very clear and sometime confusing but you can work on the classes above, is no so difficult.

Best regards, Mike

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.