[FFmpeg-user] Help with generating HLS from RTSP

Luke l1 at newanswertech.com
Thu Jun 26 10:46:25 CEST 2014


Does anyone have any tips for creating an HLS from an RTSP stream?  I'm 
experiencing errors and dropped data with my current method.

The setup:

Darwin Streaming Server on localhost, streaming, for testing, a playlist of 
three copies of the same two second test mp4 movie.

The ffmpeg command, on localhost, is:

ffmpeg -i rtsp://172.31.17.213:554/test624 \
-acodec libfdk_aac -ac 2 -b:a 128k -vcodec libx264 -fpre 
$HOME/ffmpeg_build/share/ffmpeg/libx264-ipod640.ffpreset -b:v 500k -threads 0 -g 
75 -level 3.1 \
-map 0 -vbsf h264_mp4toannexb \
-flags -global_header -f segment \
-segment_time 10 \
-segment_list test.m3u8 -segment_list_flags +live \
-segment_list_entry_prefix http://somewhere.com/folder/ 
-segment_format mpegts stream%05d.ts

It works for a few minutes, but then fails.

ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
   built on Jun  1 2014 06:16:27 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
   configuration: --prefix=/home/video/ffmpeg_build 
--extra-cflags=-I/home/video/ffmpeg_build/include 
--extra-ldflags=-L/home/video/ffmpeg_build/lib --bindir=/home/video/bin 
--extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac 
--enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora 
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
   libavutil      52. 87.100 / 52. 87.100
   libavcodec     55. 65.100 / 55. 65.100
   libavformat    55. 42.100 / 55. 42.100
   libavdevice    55. 13.101 / 55. 13.101
   libavfilter     4.  5.100 /  4.  5.100
   libswscale      2.  6.100 /  2.  6.100
   libswresample   0. 19.100 /  0. 19.100
   libpostproc    52.  3.100 / 52.  3.100
Input #0, rtsp, from 'rtsp://172.31.17.213:554/test624':
   Metadata:
     title           : test624
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 380x480 [SAR 
1:1 DAR 19:24], 30 fps, 30 tbr, 90k tbn, 1k tbc
     Stream #0:1: Audio: aac, 22050 Hz, stereo, fltp
[libx264 @ 0x28ff0a0] using SAR=1/1
[libx264 @ 0x28ff0a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x28ff0a0] profile Constrained Baseline, level 3.0
[segment @ 0x29365c0] Codec for stream 0 does not use global headers but 
container format requires global headers
[segment @ 0x29365c0] Codec for stream 1 does not use global headers but 
container format requires global headers
Output #0, segment, to 'stream%05d.ts':
   Metadata:
     title           : test624
     encoder         : Lavf55.42.100
     Stream #0:0: Video: h264 (libx264), yuv420p, 380x480 [SAR 1:1 DAR 19:24], 
q=-1--1, 500 kb/s, 30 fps, 90k tbn, 30 tbc
     Metadata:
       encoder         : Lavc55.65.100 libx264
     Stream #0:1: Audio: aac (libfdk_aac), 22050 Hz, stereo, s16, 128 kb/s
     Metadata:
       encoder         : Lavc55.65.100 libfdk_aac
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 -> libx264)
   Stream #0:1 -> #0:1 (aac -> libfdk_aac)
Press [q] to stop, [?] for help
[mpeg4 @ 0x28b5b40] warning: first frame is no keyframe
[mpeg4 @ 0x28b5b40] RTP: missed 241 packets
[mpeg4 @ 0x28b5b40] concealing 320 DC, 320 AC, 320 MV errors in P frame
[aac @ 0x28b6820] RTP: missed 12 packets=00:00:07.83 bitrate=N/A dup=173 drop=0
frame= 5221 fps= 31 q=24.0 size=N/A time=00:02:53.98 bitrate=N/A dup=173 drop=0

Then, eventually, I start seeing a vast quantity of the below:

[rtsp @ 0x28b3080] CSeq 18 expected, 17 received.
[aac @ 0x28b6820] RTP: missed 2665 packets
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets00:08:20.03 bitrate=N/A dup=6983 drop=0
[mpeg4 @ 0x28b5b40] concealing 468 DC, 468 AC, 468 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 11 packets0:08:20.26 bitrate=N/A dup=6983 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 4 packets
[mpeg4 @ 0x28b5b40] RTP: missed 5 packets
[mpeg4 @ 0x28b5b40] concealing 133 DC, 133 AC, 133 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 5 packets00:08:20.60 bitrate=N/A dup=6989 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 1 packets
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets0:08:23.80 bitrate=N/A dup=6995 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 21 packets
[mpeg4 @ 0x28b5b40] RTP: missed 129 packets:08:24.70 bitrate=N/A dup=7014 drop=0
[mpeg4 @ 0x28b5b40] concealing 375 DC, 375 AC, 375 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 6 packets
     Last message repeated 1 times
[mpeg4 @ 0x28b5b40] RTP: missed 7 packets
[mpeg4 @ 0x28b5b40] RTP: missed 6 packets00:08:27.76 bitrate=N/A dup=7102 drop=0
     Last message repeated 1 times
[mpeg4 @ 0x28b5b40] RTP: missed 6 packets00:08:28.26 bitrate=N/A dup=7115 drop=0
     Last message repeated 1 times
[mpeg4 @ 0x28b5b40] RTP: missed 30 packets0:08:28.73 bitrate=N/A dup=7127 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 31 packets
[mpeg4 @ 0x28b5b40] concealing 296 DC, 296 AC, 296 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 13 packets0:08:29.20 bitrate=N/A dup=7139 drop=0
[mpeg4 @ 0x28b5b40] concealing 396 DC, 396 AC, 396 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 24 packets
[mpeg4 @ 0x28b5b40] concealing 154 DC, 154 AC, 154 MV errors in P frame
[mpeg4 @ 0x28b5b40] RTP: missed 6 packets00:08:30.30 bitrate=N/A dup=7170 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets00:08:30.53 bitrate=N/A dup=7176 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 6 packets00:08:31.13 bitrate=N/A dup=7193 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets00:08:31.36 bitrate=N/A dup=7199 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 1 packets00:08:31.50 bitrate=N/A dup=7202 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 7 packets00:08:31.86 bitrate=N/A dup=7211 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets
[mpeg4 @ 0x28b5b40] RTP: missed 5 packets
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets
[mpeg4 @ 0x28b5b40] RTP: missed 7 packets00:08:32.33 bitrate=N/A dup=7221 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 1 packets00:08:32.56 bitrate=N/A dup=7226 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets00:08:32.86 bitrate=N/A dup=7233 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets
     Last message repeated 1 times
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets00:08:33.30 bitrate=N/A dup=7242 drop=0
[mpeg4 @ 0x28b5b40] RTP: missed 2 packets
[mpeg4 @ 0x28b5b40] RTP: missed 3 packets
...

What am I doing wrong?

Thanks

Luke



More information about the ffmpeg-user mailing list