Opened 6 years ago

Last modified 4 years ago

#7144 new defect

mpeg-dash - Application provided duration: -1056 / timestamp: 983056 is out of range for mov/mp4 format

Reported by: andreymal Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: dash
Cc: junli1026@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I have an IP Camera: Falcon Eye FE-MTR300-HD. And I want to remux RTSP camera stream to MPEG-DASH stream for web browsers, but it breaks after few hours. I guess this error can be the cause.

$ ffmpeg -loglevel warning -i [input-stream] -c:v copy -an -f dash -seg_duration 2 dash/manifest.mpd
[dash @ 0x3b194c0] No bit rate set for stream 0
[mp4 @ 0x3bec8c0] Application provided duration: -544 / timestamp: 32528 is out of range for mov/mp4 format
[mp4 @ 0x3bec8c0] Application provided duration: -528 / timestamp: 80544 is out of range for mov/mp4 format
[mp4 @ 0x3bec8c0] Application provided duration: -528 / timestamp: 128544 is out of range for mov/mp4 format
... and many other lines, one per segment ...

I also tried -avoid_negative_ts make_non_negative and/or -fflags +genpts, but nothing changed.

ffmpeg ... -c copy test.mp4 or ffmpeg ... -f segment %07d.mp4 works without errors, so I think this is dash bug.

I do not exclude that the problem is in the camera and the stream may be broken, but I can't influence it. (Can ffmpeg fix the broken stream without transcoding, please? :)

This problem affects any ffmpeg >=3.4 version, including latest git-2018-04-17-2fc12f4 (tested on Ubuntu 16.04 and Debian 8)

P.S. Possible duplicate of #6778, but I can provide additional information; see attached dash_mp4_timestamp_error.flv to reproduce this (grabbed from original RTSP stream).

P.P.S. Default loglevel, if you want:

$ ffmpeg -i dash_mp4_timestamp_error.flv -c:v copy -an -f dash -seg_duration 2 dash/manifest.mpd
ffmpeg version git-2018-04-17-2fc12f4 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/home/andreymal/ffmpeg_build --pkg-config-flags=--static
         --extra-cflags=-I/home/andreymal/ffmpeg_build/include
         --extra-ldflags=-L/home/andreymal/ffmpeg_build/lib
         --extra-libs='-lpthread -lm' --bindir=/home/andreymal/bin
         --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
         --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
         --enable-libx264 --enable-nonfree
  libavutil      56. 15.100 / 56. 15.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 18.100 /  7. 18.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, flv, from 'test.flv':
  Metadata:
    title           : 10
    encoder         : Lavf57.83.100
  Duration: 00:02:57.25, start: 3.301000, bitrate: 190 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 30 tbr, 1k tbn
[dash @ 0x3910f80] No bit rate set for stream 0
[dash @ 0x3910f80] Opening 'dash/init-stream0.m4s' for writing
Output #0, dash, to 'dash/manifest.mpd':
  Metadata:
    title           : 10
    encoder         : Lavf58.13.100
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, q=2-31, 30 tbr, 16k tbn, 1k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[dash @ 0x3910f80] Opening 'dash/chunk-stream0-00001.m4s.tmp' for writing
[dash @ 0x3910f80] Opening 'dash/manifest.mpd.tmp' for writing
[mp4 @ 0x39d6a80] Application provided duration: -544 / timestamp: 32528 is out of range for mov/mp4 format
[dash @ 0x3910f80] Opening 'dash/chunk-stream0-00002.m4s.tmp' for writing
[dash @ 0x3910f80] Opening 'dash/manifest.mpd.tmp' for writing
[mp4 @ 0x39d6a80] Application provided duration: -528 / timestamp: 80544 is out of range for mov/mp4 format

... many similar lines ...

[mp4 @ 0x39d6a80] Application provided duration: -1056 / timestamp: 2780048 is out of range for mov/mp4 format
[dash @ 0x3910f80] Opening 'dash/chunk-stream0-00065.m4s.tmp' for writing
[dash @ 0x3910f80] Opening 'dash/manifest.mpd.tmp' for writing
[mp4 @ 0x39d6a80] Application provided duration: -1056 / timestamp: 2814720 is out of range for mov/mp4 format
[dash @ 0x3910f80] Opening 'dash/chunk-stream0-00066.m4s.tmp' for writing
[dash @ 0x3910f80] Opening 'dash/manifest.mpd.tmp' for writing
frame= 2079 fps=0.0 q=-1.0 Lsize=N/A time=00:02:57.25 bitrate=N/A speed=4.7e+03x    
video:4071kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Attachments (6)

dash_mp4_timestamp_error.flv (737.0 KB ) - added by andreymal 6 years ago.
Grabbed from the RTSP stream of IP camera
dash_mp4_timestamp_error_hikvision.flv (166.3 KB ) - added by andreymal 5 years ago.
Grabbed from the RTSP stream of IP camera
hikvision_debug.txt (16.5 KB ) - added by andreymal 5 years ago.
dash_mp4_hikvision_debug.flv (268.1 KB ) - added by andreymal 5 years ago.
Recorded with loglevel debug
dash_mp4_timestamp_error_hikvision_2019.flv (139.7 KB ) - added by andreymal 4 years ago.
dash_mp4_timestamp_error_hikvision_2019.txt (376.8 KB ) - added by andreymal 4 years ago.

Download all attachments as: .zip

Change History (14)

by andreymal, 6 years ago

Grabbed from the RTSP stream of IP camera

comment:1 by Carl Eugen Hoyos, 6 years ago

The warning is shown since 51000b994514e64a6c5039e179f20c9e24f87c45

comment:2 by andreymal, 5 years ago

Now I have access to another camera Hikvision DS-2CD2032-I with the same problem. It is always online, so I can test something at any time, if necessary. See attached dash_mp4_timestamp_error_hikvision.flv

by andreymal, 5 years ago

Grabbed from the RTSP stream of IP camera

comment:3 by Carl Eugen Hoyos, 5 years ago

Please run the recording of the flv stream with -loglevel debug and attach the log file here.

comment:4 by andreymal, 5 years ago

ffmpeg -loglevel debug -analyzeduration 2 -rtsp_transport tcp -i rtsp://admin:123456@192.168.1.13/Streaming/Channels/102 -c:v copy -an dash_mp4_hikvision_debug.flv 2>&1 | tee hikvision_debug.txt

by andreymal, 5 years ago

Attachment: hikvision_debug.txt added

by andreymal, 5 years ago

Recorded with loglevel debug

in reply to:  4 comment:5 by Jun Li, 5 years ago

Cc: junli1026@gmail.com added

Replying to andreymal:

I checked the code, the error message is actually a kind of "warning", the information shows only when start a new segment and mean while the current packet->pts is smaller than duration. Ffmpeg will adjust the timestamp in this case. So I believe the disconnection may be caused by some other reason ?

Do you have more detailed logs ? Especially when rtsp drops connection?

in reply to:  4 comment:6 by Jun Li, 5 years ago

The content looks like variable frame rate, could you try set the -r 30 on output ?

comment:7 by andreymal, 5 years ago

Oh, the camera broke and is not available now :( I don't know when it will be repaired, so now it is difficult to answer. I'll try to experiment with other cameras, but I'm not sure that the problem will be reproduced

when rtsp drops connection

The rtsp connection was not dropped, only the mpeg-dash stream was broken

comment:8 by andreymal, 4 years ago

Well, my Hikvision camera is online now, and I still have this problem. Now I tried this command:

ffmpeg -loglevel debug -debug_ts -y \
  -rtsp_transport tcp -stimeout 10000000 -i 'rtsp://admin:123456@192.168.1.13/Streaming/Channels/102' \
  -map 0:v -c:v copy -an -f dash -min_seg_duration 100000 -window_size 16 \
  -extra_window_size 4 -remove_at_exit 1 dash/manifest.mpd \
  -map 0 -c copy dash_mp4_timestamp_error_hikvision_2019.flv

The recorded video file and the log is attached. I can test and record something else if needed.

The content looks like variable frame rate

I want to keep variable frame rate as is. I also tried "-vsync passthrough", but the problem is still present.

Note: See TracTickets for help on using tickets.