Replies: 1 comment
-
Hey, how did you measure latency? I suggest using two cameras, one as an observer and other one as a source. Both looking at stopwatch so you can see the timespan. Reliable measurement is a very first step. To me, ffmpeg command looks a bit overloaded. As soon as you start doing any transcoding it will introduce latency. Play with tcp/udp. Try using simething like this:
Good luck! |
Beta Was this translation helpful? Give feedback.
-
Question
Hello everyone,
I'm currently working on transcoding an RTSP input into an RTSP output with the goal of achieving the lowest possible latency to support adaptive bitrate functionality. I'm using ffmpeg and have constructed the following command:
ffmpeg -re -rtsp_transport tcp -fflags +nobuffer -max_delay 0 -analyzeduration 1000000 -probesize 100000 -i rtsp://172.31.x.x:8554/stream -s:v 1920x1080 -pix_fmt yuv420p -b:v 6000k -maxrate 6000k -max_muxing_queue_size 1024 -muxdelay 0 -muxpreload 0 -c:v libx264 -c:a libopus -b:a 64k -vsync 0 -preset ultrafast -tune zerolatency -g 12 -bf 0 -flags+cgop -f rtsp rtsp://172.31.x.x:8554/stream1080p
I have a few questions regarding this setup:
Parameter Order: Is the order of parameters in my command optimal, or would you suggest any adjustments?
Latency Optimization: Are there any additional modifications or parameter tweaks you recommend to further minimize latency for a real-time RTSP output?
Adaptive Bitrate Tips: Does anyone have insights or best practices on implementing adaptive bitrate through transcoding with ffmpeg?
For context, after integrating the new RTSP stream into mediamtx, I've observed a delay of about 1-2 seconds compared to the original source.
Mediamtx: v1.9.3, ffmpeg: v4.4.2
Any feedback or suggestions would be greatly appreciated. Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions