at the moment some colleagues and myself are working on our end-of-school-project, which is a FPV-Drone, where we're doing the electronics and more importantly the Live-Video ourselves.

For this Video-Transmission we have an analogue Camera, which sends a CVBS Signal over a TBS-Unify Transmitter to a Receiver, from where we then Grab the Videosignal and digitize it via a USB2.0-Videograbber (one like this) and stick it into a USB-Port on our Ground-Station a.k.a a Raspberry PI.

Now the Interesting part, the Device is being detected by linux as a /dev/video0 device. This device then acts as the input for the conversion via FFMPEG to an RTMP-Stream, following that gets distributed and can be accessed via a running NGINX-Server on the same RaspberryPi.

Now the problems, it takes ages to load, is laggy as hell and has a massive amount of latency in the range of 5-30s.

I have tested the video input directly from the USB-Interface using VLC-Player, where it has an acceptable amount of delay of ~1s. So, I come to the conclusion that I'm doing something terribly wrong or misunderstanding the conversion via ffmpeg, since it doesn't seem to be such a major problem for other people.

Sidenote, while vlc runs this RTMP-Conversion we get the following warning:

[video4linux2,v4l2 @ 0x55bddeb710] Dequeued v4l2 buffer contains 827396 bytes, but 829440 were expected. Flags: 0x00002001.
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1937.166532, bitrate: 165888 kb/s
  Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x576, 165888 kb/s, 25 fps, 25 tbr, 1000k tbn

I have come to the conclusion that these missing bytes in the buffer are simply because if the transmission over the air, but I wanted to add it if its important

The FFMPEG Command Line Arguments:

fpv@raspberrypi:~ $ ffmpeg -f v4l2 -standard pal -i /dev/video0 -c:v libx264 -crf 23 -an -strict experimental -preset ultrafast -tune zerolatency -maxrate 3000k -fflags nobuffer -fflags discardcorrupt -r 24 -vf scale=480:320 -f flv rtmp://

Here come my questions:

  • Is there something I'm doing inherently wrong or missing during the conversion from the device to the final RTMP-Stream?
  • Is it normal that the Buffer size for a Video of is so unbelivably large (~800000 bytes) / is there some way to compress / reduce that amount
  • Are all those flags I have found on the internet to speed up the conversion even sensical or are the just thin air, bloating the length of the command?

I really have run out of ideas on how to improve on the current sorry state of our video transmission and would now be greatly appreciative if people more knowledgeable than myself in ffmpeg and video in general could lend me a hand here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.