[FFmpeg-user] Ffmpeg freeze after a random time receiving live rtsp stream
Anacelia Sarlo
anacelia.sarlo at gmail.com
Sun May 22 21:49:33 CEST 2016
Hello,
I want to do the following in real time : receive a live rtsp stream
(input), copy video & audio stream as is, remux them in a mpeg-ts format,
attach the appropiate PIDs, and finally generate an udp multicast stream
(output).
Ffmpeg command works ok for hours, but suddenly, at random times, the video
and audio (ffplay output) freeze and the ffmpeg command also hang. I have
to press Ctrl+C to stop it and then appeared a line with the ffmpeg
statistics, with no errors.
At this time, when this happen I also have a ping checking the network
connection, but not seems to be a network problem.
I'am attaching the output console of the ffmpeg command :
[anacelia at ASR ~]$ ffmpeg -loglevel debug -y -fflags +genpts -threads 0
-rtbufsize 2G -rtsp_transport tcp -i rtsp://xxxxxxxx -map 0 -c copy -copyts
-f mpegts -mpegts_pmt_start_pid 66 -streamid 1:71 -streamid 0:70 -bufsize
2000K udp://192.168.1.109:1234?pkt_size?1316
ffmpeg version N-79273-gd433623 Copyright (c) 2000-2016 the FFmpeg
developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --pkg-config-flags=--static --enable-gpl --enable-nonfree
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 20.100 / 55. 20.100
libavcodec 57. 34.100 / 57. 34.100
libavformat 57. 31.100 / 57. 31.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 41.100 / 6. 41.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument
'+genpts'.
Reading option '-threads' ... matched as AVOption 'threads' with argument
'0'.
Reading option '-rtbufsize' ... matched as AVOption 'rtbufsize' with
argument '2G'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport'
with argument 'tcp'.
Reading option '-i' ... matched as input file with argument 'rtsp://
stream.tn.com.ar/live/tnhd1'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0'.
Reading option '-c' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '-copyts' ... matched as option 'copyts' (copy timestamps)
with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'mpegts'.
Reading option '-mpegts_pmt_start_pid' ... matched as AVOption
'mpegts_pmt_start_pid' with argument '66'.
Reading option '-streamid' ... matched as option 'streamid' (set the value
of an outfile streamid) with argument '1:71'.
Reading option '-streamid' ... matched as option 'streamid' (set the value
of an outfile streamid) with argument '0:70'.
Reading option '-bufsize' ... matched as AVOption 'bufsize' with argument
'2000K'.
Reading option 'udp://192.168.1.109:1234?pkt_size?1316' ... matched as
output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Applying option copyts (copy timestamps) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://stream.tn.com.ar/live/tnhd1.
Successfully parsed a group of options.
Opening an input file: rtsp://stream.tn.com.ar/live/tnhd1.
[tcp @ 0x2867f80] No default whitelist set
[rtsp @ 0x28678a0] SDP:
v=0
o=- 745898731 745898731 IN IP4 127.0.0.1
s=rtmp://yyyyyyyyyyyyyy
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
a=range:npt=now-
a=control:*
m=audio 0 RTP/AVP 96
a=rtpmap:96 mpeg4-generic/48000/2
a=fmtp:96
profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1190
a=control:trackID=1
m=video 0 RTP/AVP 97
a=rtpmap:97 H264/90000
a=fmtp:97
packetization-mode=1;profile-level-id=42001E;sprop-parameter-sets=Z0KAHpZSAUBf8uAqEAAAAwAQAAADAy4GAA27gABGMP8Y4wMABt3AACMYf4xw7QoVJA==,aMuNSA==
a=cliprect:0,0,360,640
a=framesize:97 640-360
a=framerate:25.0
a=control:trackID=2
[rtsp @ 0x28678a0] audio codec set to: aac
[rtsp @ 0x28678a0] audio samplerate set to: 48000
[rtsp @ 0x28678a0] audio channels set to: 2
[rtsp @ 0x28678a0] video codec set to: h264
[rtsp @ 0x28678a0] RTP Packetization Mode: 1
[rtsp @ 0x28678a0] RTP Profile IDC: 42 Profile IOP: 0 Level: 1e
[rtsp @ 0x28678a0] Extradata set to 0x286f4f0 (size: 61)
[rtsp @ 0x28678a0] setting jitter buffer size to 0
Last message repeated 1 times
[rtsp @ 0x28678a0] hello state=0
[rtsp @ 0x28678a0] All info found
[rtsp @ 0x28678a0] rfps: 24.416667 0.017067
[rtsp @ 0x28678a0] rfps: 24.500000 0.012583
[rtsp @ 0x28678a0] rfps: 24.583333 0.008841
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 24.666667 0.005839
[rtsp @ 0x28678a0] rfps: 24.750000 0.003579
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 24.833333 0.002059
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 24.916667 0.001281
[rtsp @ 0x28678a0] rfps: 25.000000 0.001244
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 25.083333 0.001948
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 25.166667 0.003392
[rtsp @ 0x28678a0] rfps: 25.250000 0.005578
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 25.333333 0.008506
[rtsp @ 0x28678a0] rfps: 25.416667 0.012174
[rtsp @ 0x28678a0] rfps: 25.500000 0.016583
Last message repeated 1 times
[rtsp @ 0x28678a0] rfps: 50.000000 0.004975
Last message repeated 1 times
Input #0, rtsp, from 'rtsp://xxxxxxxxxxxx':
Metadata:
title : rtmp://yyyyyyyyyyyyyyyyyyyyyyy
Duration: N/A, start: 0.384000, bitrate: N/A
Stream #0:0, 99, 1/48000: Audio: aac (LC), 48000 Hz, stereo, fltp
Stream #0:1, 28, 1/90000: Video: h264 (Baseline), 3 reference frames,
yuv420p(tv, left), 640x360 (640x368) [SAR 1:1 DAR 16:9], 1/50, 25 fps, 25
tbr, 90k tbn, 50 tbc
Successfully opened the file.
Parsing a group of options: output file udp://
192.168.1.109:1234?pkt_size?1316.
Applying option map (set input stream mapping) with argument 0.
Applying option c (codec name) with argument copy.
Applying option f (force format) with argument mpegts.
Applying option streamid (set the value of an outfile streamid) with
argument 1:71.
Applying option streamid (set the value of an outfile streamid) with
argument 0:70.
Successfully parsed a group of options.
Opening an output file: udp://192.168.1.109:1234?pkt_size?1316.
[udp @ 0x2aeabc0] No default whitelist set
Successfully opened the file.
[mpegts @ 0x29e0fa0] muxrate VBR, pcr every 9000 pkts, sdt every 200,
pat/pmt every 40 pkts
Output #0, mpegts, to 'udp://192.168.1.109:1234?pkt_size?1316':
Metadata:
title : rtmp://yyyyyyyyyyyyyyyyyyy
encoder : Lavf57.31.100
Stream #0:0, 0, 1/90000: Audio: aac (LC), 48000 Hz, stereo
Stream #0:1, 0, 1/90000: Video: h264, 1 reference frame, yuv420p(left),
640x360 (0x0) [SAR 1:1 DAR 16:9], 1/90000, q=2-31, 25 fps, 25 tbr, 90k tbn,
90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
Last message repeated 49 times
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151560, current: 133920; changing to 151561. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151561, current: 137430; changing to 151562. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151562, current: 140760; changing to 151563. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151563, current: 144630; changing to 151564. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151564, current: 147870; changing to 151565. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:1; previous:
151565, current: 151560; changing to 151566. This may result in incorrect
timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:0; previous:
625348350, current: 625344390; changing to 625348351. This may result in
incorrect timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:0; previous:
625348351, current: 625346310; changing to 625348352. This may result in
incorrect timestamps in the output file.
[mpegts @ 0x29e0fa0] Non-monotonous DTS in output stream 0:0; previous:
625348352, current: 625348230; changing to 625348353. This may result in
incorrect timestamps in the output file.
frame=516255 fps= 24 q=-1.0 Lsize= 2605397kB time=05:44:14.76
bitrate=1033.3kbits/s speed=0.943x
After Ctrl+C
^CError writing trailer of udp://192.168.1.109:1234?pkt_size?1316:
Immediate exit requested
video:2268786kB audio:80839kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 10.885654%
Input file #0 (rtsp://stream.tn.com.ar/live/tnhd1):
Input stream #0:0 (audio): 968179 packets read (82779357 bytes);
Input stream #0:1 (video): 516255 packets read (2323236997 bytes);
Total: 1484434 packets (2406016354 bytes) demuxed
Output file #0 (udp://192.168.1.109:1234?pkt_size?1316):
Output stream #0:0 (audio): 968179 packets muxed (82779357 bytes);
Output stream #0:1 (video): 516255 packets muxed (2323236997 bytes);
Total: 1484434 packets (2406016354 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x29f27c0] Statistics: 0 seeks, 2101707 writeouts
The same happened in my PC (CentOS 6.7) and my Raspberry (Debian Jessie 8).
I'll appreciate any suggestion.
Thanks a lot in advance.
Anacelia
More information about the ffmpeg-user
mailing list