Opened 6 years ago

Closed 6 years ago

#5574 closed defect (invalid)

unacceptable latency to convert rtsp to hls with ffmpeg

Reported by: fanniewang Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
We need to play our rtsp live streaming in ios, so we used ffmpeg to convert rtsp to hls, and then publish the m3u8 file by nginx.
But after then, we see huge latency when play it, pls help to check the follow command, and help to fix the latency for me, thanks a lot.

ffmpeg -i rtsp://kanq:kanq12345@ -c:v copy -preset ultrafast -fflags flush_packets -tune zerolatency -an -g 1 -flags -global_header -f hls -hls_time 1 -hls_list_size 3 -hls_wrap 3 play280.m3u8

[root@localhost ffmpeg-3.0.2-64bit-static]# ffmpeg -v
ffmpeg version 2.7.git Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --prefix=/wlian/ffmpeg_build --extra-cflags=-I/wlian/ffmpeg_build/include --extra-ldflags=-L/wlian/ffmpeg_build/lib --bindir=/wlian/bin --extra-libs=-ldl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --enable-ffplay --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-gpl
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 58.100 / 56. 58.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 37.100 / 5. 37.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

Change History (2)

comment:1 by Timo R., 6 years ago

In order to play HLS the player has to download the last 3 segments of the list in advance. So you allways have at least a delay of segmentTime*3.
There is nothing ffmpeg can do about that, that's just how HLS and similar systems work.

Best you can do is reduce the length of your segments. But as each segment has to start with an I frame, there is a limit in how short you can make them.

comment:2 by Carl Eugen Hoyos, 6 years ago

Keywords: ffmpeg version 2.7.git removed
Priority: importantnormal
Resolution: invalid
Status: newclosed
Type: sponsoring requestdefect
Version: 2.7.3unspecified

For future tickets please remember to test current FFmpeg git head before reporting an issue here.

Note: See TracTickets for help on using tickets.