Opened 4 months ago

Last modified 4 months ago

#6415 reopened defect

Strange DTS of first packet in RTSP stream

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

Description

If I stream mp4 file from one ffmpeg instance to another throigh rtsp protocol I get warnings on incoming site though dts in source mp4 file are ordered:

cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 2 times
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 5690
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 9290
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 12890
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 16490
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 20090
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 23690

When I check frame dts I get them in this order:

{buf = 0x81900f140, pts = 9200, dts = 9200, data = 0x8192be980 "", size = 31378, stream_index = 0, flags = 1, side_data = 0x0, side_data_elems = 0, duration = 3600,
  pos = -1, convergence_duration = 0}
{buf = 0x81900f3e0, pts = -8800, dts = -8800, data = 0x819069000 "", size = 981, stream_index = 0, flags = 0, side_data = 0x0, side_data_elems = 0, duration = 3600,
  pos = -1, convergence_duration = 0}
{buf = 0x81900f520, pts = -5200, dts = -5200, data = 0x819074300 "", size = 1082, stream_index = 0, flags = 0, side_data = 0x0, side_data_elems = 0, duration = 3600,
  pos = -1, convergence_duration = 0}
{buf = 0x81900f660, pts = -1600, dts = -1600, data = 0x819074d00 "", size = 1078, stream_index = 0, flags = 0, side_data = 0x0, side_data_elems = 0, duration = 3600,
  pos = -1, convergence_duration = 0}

Where first dts=9200 is coming from?

How to reproduce:
sending part:

ffmpeg -re -i source.mp4 -acodec copy -vcodec copy -f rtsp -muxdelay 0.1 rtsp://test.mysite.com/in/1

listening part:

% ffmpeg -loglevel debug -rtsp_transport tcp -rtsp_flags listen -i rtsp://test.mysite.com/in/1 -acodec copy -vcodec copy -f null /dev/null

ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
  configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/share/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic --enable-gp
l --enable-postproc --enable-avfilter --enable-avresample --enable-pthreads --cc=cc --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-am
rwb --disable-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt --disable-chromaprint --disable-libdc1394 --disable-stripping --enable-htmlpages --ena
ble-libfdk-aac --enable-ffserver --disable-libflite --disable-fontconfig --disable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --disable-libgsm --disable-ic
onv --disable-libilbc --disable-indev=jack --disable-libkvazaar --disable-ladspa --disable-libmp3lame --disable-libbluray --enable-mmx --disable-libmodplug --disable-netcdf --disa
ble-openal --disable-indev=openal --disable-opencl --disable-libopencv --disable-opengl --disable-libopenh264 --disable-libopenjpeg --enable-optimizations --disable-libopus --disa
ble-libpulse --disable-indev=pulse --disable-outdev=pulse --enable-runtime-cpudetect --disable-librubberband --disable-libschroedinger --disable-ffplay --disable-outdev=sdl --disa
ble-sdl2 --disable-libsmbclient --disable-libsnappy --disable-indev=sndio --disable-outdev=sndio --disable-libsoxr --disable-libspeex --enable-sse --disable-libssh --disable-libte
sseract --enable-libtheora --disable-libtwolame --disable-libv4l2 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-vaapi --disable-vdpau --disable-libvidstab --enable-libvorbi
s --disable-libvo-amrwbenc --enable-libvpx --disable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265 --disable-libxcb --enable-libxvid --disable-outdev=xv --disable
-libzimg --disable-libzmq --disable-libzvbi --disable-gcrypt --enable-gmp --disable-librtmp --disable-gnutls --enable-openssl --enable-version3 --enable-nonfree
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-rtsp_flags' ... matched as AVOption 'rtsp_flags' with argument 'listen'.
Reading option '-i' ... matched as input url with argument 'rtsp://test.mysite.com/in/1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '/dev/null' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://test.mysite.com/in/1.
Successfully parsed a group of options.
Opening an input file: rtsp://test.mysite.com/in/1.
[tcp @ 0x807e820a0] No default whitelist set
[rtsp @ 0x807e7c000] Updating control URI to rtsp://test.mysite.com:554/in/1
[rtsp @ 0x807e7c000] SDP: v=0^M
o=- 0 0 IN IP4 127.0.0.1^M
s=No Name^M
c=IN IP4 5.9.120.9^M
t=0 0^M
a=tool:libavformat 57.71.100^M
m=video 0 RTP/AVP 96^M
b=AS:612^M
a=rtpmap:96 H264/90000^M
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LAH9mAoC/5cBEAAAMAAQAAAwAyDxgyaA==,aMlhyyA=; profile-level-id=42C01F^M
a=control:streamid=0^M
m=audio 0 RTP/AVP 97^M
b=AS:103^M
a=rtpmap:97 MPEG4-GENERIC/44100/2^M
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210^M
a=control:streamid=1^M

[rtsp @ 0x807e7c000] video codec set to: h264
[rtsp @ 0x807e7c000] RTP Packetization Mode: 1
[rtsp @ 0x807e7c000] Extradata set to 0x807e74140 (size: 38)
[rtsp @ 0x807e7c000] RTP Profile IDC: 42 Profile IOP: c0 Level: 1f
[rtsp @ 0x807e7c000] audio codec set to: aac
[rtsp @ 0x807e7c000] audio samplerate set to: 44100
[rtsp @ 0x807e7c000] audio channels set to: 2
[rtp @ 0x807e23700] No default whitelist set
[udp @ 0x807e82280] No default whitelist set
[udp @ 0x807e82280] end receive buffer size reported is 65536
[udp @ 0x807e82320] No default whitelist set
[udp @ 0x807e82320] end receive buffer size reported is 65536
[rtsp @ 0x807e7c000] setting jitter buffer size to 500
[rtp @ 0x807e23780] No default whitelist set
[udp @ 0x807e823c0] No default whitelist set
[udp @ 0x807e823c0] bind failed: Address already in use
[rtp @ 0x807e23780] No default whitelist set
[udp @ 0x807e823c0] No default whitelist set
[udp @ 0x807e823c0] end receive buffer size reported is 65536
[udp @ 0x807e82460] No default whitelist set
[udp @ 0x807e82460] end receive buffer size reported is 65536
[rtsp @ 0x807e7c000] setting jitter buffer size to 500
Failed to parse interval end specification ''
[h264 @ 0x807e16f00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x807e16f00] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x807e16f00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x807e16f00] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x807e16f00] user data:"x264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=5 deblock=0:
0:0 analyse=0x1:0x111 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=25 keyint_min=2 scenecut=40 intra_refresh=0 rc_lo
okahead=25 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x807e16f00] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x807e16f00] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x807e16f00] user data:"x264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=5 deblock=0:
0:0 analyse=0x1:0x111 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=25 keyint_min=2 scenecut=40 intra_refresh=0 rc_lo
okahead=25 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x807e16f00] Reinit context to 640x368, pix_fmt: yuv420p
[h264 @ 0x807e16f00] nal_unit_type: 1, nal_ref_idc: 2
    Last message repeated 2 times
[aac @ 0x807e17900] skip whole frame, skip left: 0
[h264 @ 0x807e16f00] nal_unit_type: 1, nal_ref_idc: 2
    Last message repeated 2 times
[rtsp @ 0x807e7c000] All info found
Input #0, rtsp, from 'rtsp://test.mysite.com/in/1':
  Metadata:
    title           : No Name
  Duration: N/A, start: -0.159002, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Constrained Baseline), 1 reference frame, yuv420p(progressive, left), 640x360 (640x368) [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn
, 50 tbc
    Stream #0:1, 49, 1/44100: Audio: aac (LC), 44100 Hz, stereo, fltp
Successfully opened the file.
Parsing a group of options: output url /dev/null.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: /dev/null.
Successfully opened the file.
Output #0, null, to '/dev/null':
  Metadata:
    title           : No Name
    encoder         : Lavf57.71.100
    Stream #0:0, 0, 1/90000: Video: h264 (Constrained Baseline), 1 reference frame, yuv420p(progressive, left), 640x360 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 25 fps, 25 tbr, 90k
tbn, 90k tbc
    Stream #0:1, 0, 1/44100: Audio: aac (LC), 44100 Hz, stereo, fltp
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 2 times
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 5690
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 9290
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 12890
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 16490
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 20090
[null @ 0x807e7d800] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23690 >= 23690
frame=   40 fps=0.0 q=-1.0 size=N/A time=00:00:01.58 bitrate=N/A speed=3.17x    ^Mframe=   54 fps= 54 q=-1.0 size=N/A time=00:00:02.14 bitrate=N/A speed=2.14x    ^Mframe=   66 fps
= 44 q=-1.0 size=N/A time=00:00:02.62 bitrate=N/A speed=1.73x    ^Mframe=   79 fps= 39 q=-1.0 size=N/A time=00:00:03.14 bitrate=N/A speed=1.54x    ^Mframe=   92 fps= 36 q=-1.0 siz
e=N/A time=00:00:03.66 bitrate=N/A speed=1.43x    ^Mframe=  106 fps= 34 q=-1.0 size=N/A time=00:00:04.22 bitrate=N/A speed=1.37x    ^Mframe=  118 fps= 33 q=-1.0 size=N/A time=00:0
0:04.70 bitrate=N/A speed=1.31x    ^Mframe=  130 fps= 32 q=-1.0 size=N/A time=00:00:05.20 bitrate=N/A speed=1.27x    ^Mframe=  143 fps= 31 q=-1.0 size=N/A time=00:00:05.70 bitrate
=N/A speed=1.24x    ^MNo more output streams to write to, finishing.
frame=  149 fps= 31 q=-1.0 Lsize=N/A time=00:00:05.94 bitrate=N/A speed=1.24x
video:448kB audio:88kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (rtsp://test.mysite.com/in/1):
  Input stream #0:0 (video): 149 packets read (458851 bytes);
  Input stream #0:1 (audio): 253 packets read (90186 bytes);
  Total: 402 packets (549037 bytes) demuxed
Output file #0 (/dev/null):
  Output stream #0:0 (video): 149 packets muxed (458851 bytes);
  Output stream #0:1 (audio): 253 packets muxed (90186 bytes);
  Total: 402 packets (549037 bytes) muxed
0 frames successfully decoded, 0 decoding errors

I think it is the same problem as https://trac.ffmpeg.org/ticket/5018

Change History (4)

comment:1 in reply to: ↑ description Changed 4 months ago by cehoyos

  • Resolution set to duplicate
  • Status changed from new to closed

Replying to Alexander:

I think it is the same problem as https://trac.ffmpeg.org/ticket/5018

Did you confirm that reducing -probesize helps?

For future tickets: Please remember to test current FFmpeg git head before reporting issues.

comment:2 Changed 4 months ago by Alexander

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Reducing probesize doesn't solve the problem. It just hide it from console output because in this case all packets came with dts=AV_NOPTS_VALUE which is much worse!
Version from git has the same issue.

comment:3 Changed 4 months ago by cehoyos

Please provide a working url to allow me to reproduce the issue.

comment:4 Changed 4 months ago by Alexander

You can reproduce this problem on a local machine:

  1. Start listening instance of ffmpeg:
ffmpeg -loglevel debug -rtsp_transport tcp -rtsp_flags listen -i rtsp://localhost/in/1 -acodec copy -vcodec copy -f null /dev/null
  1. Start sending some mp4 file:
ffmpeg -re -i source.mp4 -acodec copy -vcodec copy -f rtsp -muxdelay 0.1 rtsp://localhost/in/1

You'll get warnings about non monotonically increasing dts on listening instance.

Note: See TracTickets for help on using tickets.