Reputation: 689
I transmit video file and receive it. I see a very long delay before first frame is received, around 5-8 seconds:
::sender.bat
ffmpeg -re -i sample.mp4 -vcodec h264 -tune fastdecode -tune zerolatency -f mpegts udp://127.0.0.1:1234
::receiver.bat
ffmpeg -i udp://127.0.0.1:1234 -y output.mp4
Upvotes: 0
Views: 1159
Reputation: 515
Try to use minimal -probesize 32
for the receiver (player). It worked for me.
probesize integer (input)
Set probing size in bytes, i.e. the size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency. Must be an integer not lesser than 32. It is 5000000 by default.
It works with option -tune zerolatency
of mpegts or with matroska (simply -f matroska
).
Upvotes: 0
Reputation: 689
I have found the answer, there is a -analyzeduration
parameter which controls the amount of time needed to identify stream type. Default is 5 seconds , when I reduced it to 1 second (-analyzeduration 1000000
), the movie started faster
Upvotes: 1
Reputation: 93048
It's due to the default x264 keyframe interval being long - 250 frames.
Keep it low. Add -g 25
for a 25 frame interval.
Also, it helps to start the receiver before the sender.
Upvotes: 2