Hi all,
I am looking into a project and not sure if I should use an RPi, and if I do, the RPi camera or a USB camera.
The key requirement for the project is to encode the camera input, transmit it to a remote device on the same wi-fi network, and have the remote device (an Android smartphone) play back the video stream with less than 200ms delay. Resolution should be 480p, but if 720p is possible, great.
1. Is this possible with the RPi A+ or B+?
2. If so, would it be better to use the ribbon camera or a USB camera?
3. If not, does anyone know which other SoC's can handle this? (E.g. BananaPi, Odroid, etc)
Thanks!
Low latency encoding and transmission possible?
Current Project: PiMac
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10584
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: Low latency encoding and transmission possible?
Yes, it's possible, though latency through Android may be variable.
http://www.raspberrypi.org/forums/viewt ... 5&p=652324
http://www.raspberrypi.org/forums/viewt ... 5&p=652324
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: Low latency encoding and transmission possible?
At work we have been doing some testing doing exactly this. Using gstreamer pipelines over RTP we have got very good results streaming from Pi to Pi, almost imperceptible latency and also Pi to PC (running VLC or similar). However, when using an Android phone over WIfi the latency was increased considerably. I think we fdid get it to go quicker, but not sure how - I wasn't doing the testing.
I think its one of those things you will need to try. I beleive it's the Android end that is the problem, not the Pi. SO probably will vary according to the handset.
I think its one of those things you will need to try. I beleive it's the Android end that is the problem, not the Pi. SO probably will vary according to the handset.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10584
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: Low latency encoding and transmission possible?
With my experience of the Android stack, very much this. Low latency, efficient, and Android rarely happens.jamesh wrote:I think its one of those things you will need to try. I beleive it's the Android end that is the problem, not the Pi. SO probably will vary according to the handset.
With recording we ended with the last 2-3 SECONDS of recordings getting dropped due to inefficient ways that the standard Android framework worked and our output FIFO had just backed up that much. We had to do nasty hacks to get it to work nicely, and there was a nice clean way to solve the issue within the framework too

Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Posts: 11
- Joined: Thu Apr 02, 2015 10:54 am
Re: Low latency encoding and transmission possible?
Hi jamesh i want to receive the stream through Pi (Using GST-RTSP server on pi) to VLC (On Windows 7 PC). As you have mentioned here that you have done so. Can you please guide me through because i am having some problems. I have used following command on Pi side to create rtsp server:jamesh wrote:At work we have been doing some testing doing exactly this. Using gstreamer pipelines over RTP we have got very good results streaming from Pi to Pi, almost imperceptible latency and also Pi to PC (running VLC or similar). However, when using an Android phone over WIfi the latency was increased considerably. I think we fdid get it to go quicker, but not sure how - I wasn't doing the testing.
I think its one of those things you will need to try. I beleive it's the Android end that is the problem, not the Pi. SO probably will vary according to the handset.
Code: Select all
raspivid -t 0 -h 320 -w 240 -rot 90 -fps 25 -b 2000000 -vf -hf -n -o - | gst-launch -v fdsrc ! h264parse ! gdppay ! tcpserversink host=192.168.1.15 port=5000 | ./test-launch "( tcpclientsrc host=192.168.1.15 port=5000 ! gdpdepay ! avdec_h264 ! rtph264pay name=pay0 pt=96 )"
and i am receiving it using VLC on windows by the rtsp://192.168.1.15:8554/test The problem is VLC is showing only a single image (i.e a single frame). While it is working smoothly on GOM player by the same link. But i need to use VLC. Please guide me through. Thanks in advance.
Re: Low latency encoding and transmission possible?
Here is a copy paste of some notes I made, I cannot guarantee these are the exact ones we used.
Code: Select all
// Source
raspivid -fps 15 -b 400000 -t 0 -n -w 640 -h 480 -o - | tee | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay ! udpsink host=192.168.1.255 port=5000
// Destination (can be same machine)
gst-launch-1.0 --gst-debug 3 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! "video/x-raw, format=(string)I420" ! eglglessink
More working Raspi send/receives
./raspivid --profile baseline --intra 15 -if cyclic -fps 15 -b 200000 -t 0 -n -w 640 -h 480 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay ! udpsink host=192.168.1.255 port=5000
gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! fbdevsink
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
-
- Posts: 11
- Joined: Thu Apr 02, 2015 10:54 am
Re: Low latency encoding and transmission possible?
Hi Jamesh, Thanks for your quick reply but none of your code worked for me (Bad luck this time...) I want to use a method so that i can receive video streaming from RPi(server) to VLC (Client) without any big lag. Although i am able to do so by using VLC on pi side but the lag is approx1-2 sec that is too much.jamesh wrote:Here is a copy paste of some notes I made, I cannot guarantee these are the exact ones we used.Code: Select all
// Source raspivid -fps 15 -b 400000 -t 0 -n -w 640 -h 480 -o - | tee | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay ! udpsink host=192.168.1.255 port=5000 // Destination (can be same machine) gst-launch-1.0 --gst-debug 3 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! "video/x-raw, format=(string)I420" ! eglglessink More working Raspi send/receives ./raspivid --profile baseline --intra 15 -if cyclic -fps 15 -b 200000 -t 0 -n -w 640 -h 480 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay ! udpsink host=192.168.1.255 port=5000 gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! omxh264dec ! fbdevsink
- eriktheitalian
- Posts: 358
- Joined: Thu Feb 19, 2015 1:03 pm
Re: Low latency encoding and transmission possible?
I'm not realy professional for this. I have questions.
Real time kernel is advantage for this process. ?
Encoding using sdcard or totaly done in sdram not ? ( for topic maker )
BFS cpu scheduler was good for screen render related latency. Is it usable for this process ?
Real time kernel is advantage for this process. ?
Encoding using sdcard or totaly done in sdram not ? ( for topic maker )
BFS cpu scheduler was good for screen render related latency. Is it usable for this process ?
I cant using enough English language. My writings can be wrong grammer.$
"in micro$oft we not trust"
"in micro$oft we not trust"
Re: Low latency encoding and transmission possible?
I need to do exactly this; stream from rpi to rpijamesh wrote:At work we have been doing some testing doing exactly this. Using gstreamer pipelines over RTP we have got very good results streaming from Pi to Pi, almost imperceptible latency and also Pi to PC (running VLC or similar). However, when using an Android phone over WIfi the latency was increased considerably. I think we fdid get it to go quicker, but not sure how - I wasn't doing the testing.
I think its one of those things you will need to try. I beleive it's the Android end that is the problem, not the Pi. SO probably will vary according to the handset.
Would you mind sharing how you solved this?