Opened 3 years ago

Last modified 3 years ago

#5702 new defect

RTP: missed while "second pass: moving the moov atom to the beginning of the file" in segmenter

Reported by: starscaper Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
How to reproduce:

% ffmpeg  'rtsp://xxx:xxx@' -codec copy -f segment -segment_time 300 -reset_timestamps 1 -segment_format_options movflags=faststart 'segment_-%04d.mp4'
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (FreeBSD Ports Collection) 

[mp4 @ 0x804025c00] Starting second pass: moving the moov atom to the beginning of the file
[file @ 0x804034480] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x80403c300] Statistics: 57420982 bytes read, 0 seeks
[segment @ 0x804025000] segment:'segment_-0000.mp4' count:0 ended
[AVIOContext @ 0x80403c200] Statistics: 36 seeks, 6724 writeouts
[file @ 0x804034400] Setting default whitelist 'file,crypto'
[segment @ 0x804025000] segment:'segment_-0001.mp4' starts with packet stream:0 pts:4608000 pts_time:300 frame:4489
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4608000 pts_time:300 dts:4608000 dts_time:300 -> pts:0 pts_time:0 dts:0 dts_time:0
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4609075 pts_time:300.07 dts:4609075 dts_time:300.07 -> pts:1075 pts_time:0.069987 dts:1075 dts_time:0.069987
frame= 4491 fps= 15 q=-1.0 size=N/A time=00:04:59.66 bitrate=N/A speed=0.998x
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4609997 pts_time:300.13 dts:4609997 dts_time:300.13 -> pts:1997 pts_time:0.130013 dts:1997 dts_time:0.130013
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4611072 pts_time:300.2 dts:4611072 dts_time:300.2 -> pts:3072 pts_time:0.2 dts:3072 dts_time:0.2
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4612147 pts_time:300.27 dts:4612147 dts_time:300.27 -> pts:4147 pts_time:0.269987 dts:4147 dts_time:0.269987
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4613069 pts_time:300.33 dts:4613069 dts_time:300.33 -> pts:5069 pts_time:0.330013 dts:5069 dts_time:0.330013
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4614144 pts_time:300.4 dts:4614144 dts_time:300.4 -> pts:6144 pts_time:0.4 dts:6144 dts_time:0.4
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4615219 pts_time:300.47 dts:4615219 dts_time:300.47 -> pts:7219 pts_time:0.469987 dts:7219 dts_time:0.469987
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4616141 pts_time:300.53 dts:4616141 dts_time:300.53 -> pts:8141 pts_time:0.530013 dts:8141 dts_time:0.530013
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4617216 pts_time:300.6 dts:4617216 dts_time:300.6 -> pts:9216 pts_time:0.6 dts:9216 dts_time:0.6
[rtsp @ 0x804024400] max delay reached. need to consume packet
[rtsp @ 0x804024400] RTP: missed 14 packets
[rtsp @ 0x804024400] max delay reached. need to consume packet
[rtsp @ 0x804024400] RTP: missed 31 packets
[rtsp @ 0x804024400] max delay reached. need to consume packet
[rtsp @ 0x804024400] RTP: missed 7 packets
[rtsp @ 0x804024400] max delay reached. need to consume packet
[rtsp @ 0x804024400] RTP: missed 105 packets
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4618291 pts_time:300.67 dts:4618291 dts_time:300.67 -> pts:10291 pts_time:0.669987 dts:10291 dts_time:0.669987
[segment @ 0x804025000] stream:0 start_pts_time:300 pts:4639795 pts_time:302.07 dts:4639795 dts_time:302.07 -> pts:31795 pts_time:2.06999 dts:31795 dts_time:2.06999

Attachments (1)

ffmpeg-20160711-103554.log (2.3 MB) - added by starscaper 3 years ago.

Change History (4)

Changed 3 years ago by starscaper

comment:1 Changed 3 years ago by cehoyos

  • Component changed from avformat to undetermined

Is the issue only reproducible with rtsp input or also with file or testsrc input?
Please test current FFmpeg git head and please explain what's wrong with the output file(s).

comment:2 Changed 3 years ago by oromit

Moving the moov atom to the front is a quite slow post processing operation.
And as ffmpeg is single threaded, it seems to take long enough for the rtsp input buffer to overflow.
Increasing the max_delay might already be enough.

comment:3 Changed 3 years ago by starscaper

I use latest source from github.

what's wrong with the output file(s).

Missing couple of seconds at the begining of 2-nd and following segments (up to 15 seconds with big segment_time (30 minutes ~ 300MB)) from rtsp

Increasing max_delay to 15 seconds solved the issue in most cases (depends on how busy server is)
I wonder if it's a good idea to increase max_delay to 15-20 seconds...
P.S. Probably I'll replace movflags=faststart whith something like moov_size=5120000

Note: See TracTickets for help on using tickets.