Opened 5 years ago

Closed 5 years ago

#4062 closed defect (fixed)

sub2video overlay fails with negative starting timestamp and -copyts

Reported by: mikaraento Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: sub
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug: If the input starts on a negative time and -copyts is given, sub2video causes 'Buffer queue overflow, dropping' messages and broken output.

Although this seems like a minor problem, the problem is easily triggered by broadcast input that has non-monotonic timestamps (will try to find a simple testcase for that and file a separate ticket).

I need -copyts to later sync video and audio if there is missing video or audio.

How to reproduce:

$ ffmpeg -y -i negative_pts_sub.ts -copyts -filter_complex '[0:0][0:3]overlay[outv0]' -map 0:1 -map '[outv0]' broken.ts
ffmpeg version N-67065-g2fa08fd Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 23 2014 08:58:30 with Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)

The following works:

$ ffmpeg -y -itsoffset 46.944644 -i negative_pts_sub.ts -copyts -filter_complex '[0:0][0:3]overlay[outv0]' -map 0:1 -map '[outv0]' working.ts

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

ffmpeg-20141029-101102.log (42.3 KB) - added by mikaraento 5 years ago.
log file from non-working comamnd
ffmpeg-20141029-101119.log (47.6 KB) - added by mikaraento 5 years ago.
log file from working command

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords sub added

Please provide the input sample and the complete, uncut console output of the failing command to make this a valid ticket.

Last edited 5 years ago by cehoyos (previous) (diff)

Changed 5 years ago by mikaraento

log file from non-working comamnd

Changed 5 years ago by mikaraento

log file from working command

comment:2 Changed 5 years ago by mikaraento

uploaded the input file to upload.ffmpeg.org/incoming

comment:3 follow-up: Changed 5 years ago by cehoyos

Does the sample you uploaded contain any subtitles? How can I see them?

comment:4 in reply to: ↑ 3 Changed 5 years ago by mikaraento

Replying to cehoyos:

Does the sample you uploaded contain any subtitles? How can I see them?

The cut-down version does not contain any subtitles that would be visible.

$ ffprobe -i negative_pts_sub.ts -select_streams s -show_packets

will show you that there are subtitle packets.

Do you want a larger sample that contains visible subtitles?

comment:5 Changed 5 years ago by cehoyos

Imo, even if the issue is reproducible without visible subtitles, it makes the issue (your issue) easier to understand if there are subtitles visible.

comment:6 Changed 5 years ago by mikaraento

Uploaded negative_pts_sub_long.ts to upload.ffmpeg.org/incoming

There are Finnish subtitles from 03min04s, viewable in VLC or by running the 'working' example command with this file (the subtitles are not scaled right, I didn't put that in the command for this ticket).

comment:7 Changed 5 years ago by Cigaes

  • Analyzed by developer set
  • Component changed from undetermined to ffmpeg
  • Reproduced by developer set
  • Status changed from new to open

Thanks for the bug report and the sample. Can you test whether the following patch fixes the problem for you?
http://ffmpeg.org/pipermail/ffmpeg-devel/2014-November/164811.html

The problem is with the heartbeat for the subtitles; since subtitles streams are sparse, overlay needs a heartbeat frame to know that subtitles have not changed and have a timestamp. The initial value for the heartbeat was left to 0, and video frames with negative timestamps would not generate heartbeat. The solution is to init it to -∞ or equivalent.

Last edited 5 years ago by Cigaes (previous) (diff)

comment:8 Changed 5 years ago by mikaraento

Thanks! Will take a look.

comment:9 Changed 5 years ago by mikaraento

Yes, the patch fixes this problem. Thank you!

comment:10 Changed 5 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.