[FFmpeg-user] Problem with FFmpeg to generate HLS segment

Xinglong Wu cakuba at gmail.com
Wed May 28 04:08:13 CEST 2014


Hi,

      we are currently working to capture audio/video streams from an IP
camera and then, to deliver segmented IOS compatible .m3u8 streams with
FFmpeg. The command we used is

ffmpeg -f rtsp -rtsp_transport tcp -i "rtsp://$ip/live" -vcodec copy
-acodec libfaac -b:a 48k -map 0 -flags -global-headers -f segment
-segment_time 5 -segment_list test.m3u8 -segment_list_type m3u8
-segment_list_size 3  -segment_format mpegts -loglevel debug liveX%08d.ts

The thus generated 5-second ts files are perfectly fine at the beginning
until something really wired happens after running the above command for 1
hour or so. From the log file, I observed that

=======================================
*[segment @ 0x28524a0] Delay between the first packet and last packet in
the muxing queue is 10066567 > 10000000: forcing output*
========================================

and this kind of message becomes more and more until finally, the duration
of ts file was reported abnormal as

==========================================
[root at Crtmp live]# ffprobe ../live/liveX00001424.ts
*ffprobe version 2.2.1* Copyright (c) 2007-2014 the FFmpeg developers
  built on Apr 21 2014 17:22:13 with gcc 4.4.7 (GCC) 20120313 (Red Hat
4.4.7-4)
  configuration: *--enable-libx264 --enable-gpl --enable-pthreads
--enable-avfilter --enable-filter=movie --enable-libfaac --enable-nonfree*
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '../live/liveX00001424.ts':
  Duration: *00:00:20.93*, start: 7115.022889, bitrate: 218 kb/s
  Program 1
    Metadata:
      service_name    : Session streamed by "rtspServerForJovision"
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B),
yuv420p, 352x288, 15 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 8000 Hz,
stereo, fltp, 44 kb/s
===================================

Actually, this liveX00001424.ts file can be easily fixed by

===================================
ffmpeg -i liveX00001424.ts -vn -acodec copy a.ts
ffmpeg -i liveX00001424.ts -an -vcodec copy v.ts
ffmpeg -i v.ts -i a.ts -c copy new.ts
===================================

So, could you please provide any kind of suggestions to fix the problem? Or
possible reasons?  Thanks.

Brett


More information about the ffmpeg-user mailing list