Page 1 of 1

h264 and the lag

Posted: Sat Dec 09, 2017 2:01 am
by MrGlasspoole
I'm trying to build a cam that i can view on my satellite receiver.
There is a plugin but it does not work with mjpeg.

Everything h264 i tried does not work that it is usable - the lag is horrible.

I tried this tutorial: https://chriscarey.com/blog/2017/04/30/ ... ra-system/

The i tried uv4l with:

Code: Select all

~# uv4l --driver raspicam --auto-video_nr --framerate 25 --extension-presence=0
~# cvlc -vvv v4l2c:///dev/video0:width=1640:height=1232:chroma=H264 --sout '#rtp{access=udp,sdp=rtsp://:8554/}' --demux h264
and showing it in VLC

Then i found: https://www.youtube.com/watch?v=JVGi8-ghO10
What i don't understand why he is using

Code: Select all

uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding h264
but then he shows a mjpeg stream.

You can call:

Code: Select all

http://10.1.255.7:8080/stream
http://10.1.255.7:8080/stream/video.h264
http://10.1.255.7:8080/stream/video.mjpeg
http://10.1.255.7:8080/stream/video.jpeg
they all give me just mjpeg - even if i set h264 on the "Camera Control Panel" page.

Is WebRTC the only way to have none slow and lagging h264?
There are so many cheap CAMs you can buy - how do they do it with less CPU/GPU power then a Raspberry?

Re: h264 and the lag

Posted: Sat Dec 09, 2017 9:12 am
by jamesh
H264 should be fine, it's quicker than mjpeg as its lower bandwidth. So its a setup problem I suspect.

I presume you are attempting to stream from Pi camera over Ethernet to some playback device?

Re: h264 and the lag

Posted: Sat Dec 09, 2017 10:00 am
by MrGlasspoole
I need rtps for my satellite receiver.

I don't know what I'm doing wrong with UV4L but i tried now GStreamer to GStreamer on Windows and the lag seems to be Ok.

Pi:

Code: Select all

~# raspivid -n -t 0 -w 1640 -h 1232 -fps 25 -b 4000000 -vf -hf -a 4 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=10.1.255.7 port=5000

Windows CMD:

Code: Select all

gst-launch-1.0.exe -v tcpclientsrc host=10.1.255.7 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=true

But i can't figure out how to get rtps running with GStreamer.
I found this: https://www.youtube.com/watch?v=ThNJGRzjWS8
So what i did:

Code: Select all

~# gst-inspect-1.0 --version
~# wget https://gstreamer.freedesktop.org/src/gst-rtsp-server/gst-rtsp-server-1.10.4.tar.xz
~# tar xf gst-rtsp-server-1.10.4.tar.xz
~# cd /home/pi/gst-rtsp-server-1.10.4/examples
~# chmod +x test-launch.c
~# ./test-launch.c "v4l2src device=/dev/video0 ! video/x-raw, format=(yuyv), framerate=15/1, width=320, height=240 ! queue ! omxh264enc ! video/x-h264, profile=(string)high ! rtph264pay name=pay0 config-interval=1 pt=96"

If i try to start the example (test-launch.c) i get:

Code: Select all

./test-launch.c: line 1: /bin: Is a directory
./test-launch.c: line 2: syntax error near unexpected token `('
./test-launch.c: line 2: ` * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>'

Re: h264 and the lag

Posted: Sat Dec 09, 2017 11:10 am
by jamesh
running test_launch.c doesn't look right at all.

Re: h264 and the lag

Posted: Sat Dec 09, 2017 11:36 am
by MrGlasspoole
These are all 'c' files.
I also downloaded v1.4.4 what the guy in the video used and it's the same.
This files are not compiled? But why does it work in that youtube video?

Re: h264 and the lag

Posted: Sat Dec 09, 2017 1:28 pm
by jamesh
Can you post a link to these C files? You don't run the .c files directly, they need to be compiled.

Re: h264 and the lag

Posted: Sat Dec 09, 2017 1:53 pm
by MrGlasspoole

Re: h264 and the lag

Posted: Thu Dec 14, 2017 3:41 am
by MrGlasspoole
Ok, did some more testing.
TCP gives me 800 and UDP 300 ms lag with GStreamer to GStreamer.

I really need help to figure out how to make a rtps stream with GStreamer that i can use on my NVR.