Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#7515 closed defect (fixed)

SRT subtitle timings wildly variable

Reported by: tim@… Owned by: markk
Priority: minor Milestone: 0.23
Component: MythTV - Video Playback Version: unknown
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Trunk, revision 22760.

When playing a video file with accompanying SRT subtitles, the subtitle timings are wildly variable. This is not apparent when comparing the subtitle timecodes with the time displayed in myth when pausing, because what is causing this problem is that the time displayed in myth is wrong, having been calculated from an apparent fps which seems to be wandering all over the place (because of A/V sync corrections). Note the video in all these cases plays perfectly; no stutter, not too fast, not too slow, so whatever the A/V sync is doing, it's obviously working :-)

The attached patch fixes the problem for me, and puts the subtitles right back on the nail of where they're supposed to be.

It's quite possible there are unintended side effects since as far as I can work out currentFrame->timecode is a long long whose size is therefore not guaranteed, and it might wrap, but most of the time it's going to be pretty big and not too many people watch movies many days long :-)

Attachments (2)

srtdiff.txt (1.1 KB) - added by tim@… 10 years ago.
Patch to fix SRT subtitle timings
t7515_srt_subtitle_fix.diff (3.5 KB) - added by tralph 10 years ago.
proper fix for SRT subtitles using timecodes

Download all attachments as: .zip

Change History (15)

Changed 10 years ago by tim@…

Attachment: srtdiff.txt added

Patch to fix SRT subtitle timings

comment:1 Changed 10 years ago by S2

This patch fixes the problem for me as well on mythtv-0-22-fixes.

comment:2 Changed 10 years ago by electoys

What is required for this patch to be submitted as a changeset? It would be appreciated in the 0.22 branch.

comment:3 Changed 10 years ago by stuartm

Ticket locked: set

comment:4 Changed 10 years ago by Stuart Auchterlonie

Milestone: unknown0.23

comment:5 Changed 10 years ago by tralph

Status: newinfoneeded_new
Ticket locked: unset

Tim, could you please provide a sample with the "wondering" fps problem? You can create a 50MB sample from the start of the video with:

dd if=input.mpg of=sample.mpg bs=1024 count=50000

and upload to a site such as filebin.ca.

Changed 10 years ago by tralph

Attachment: t7515_srt_subtitle_fix.diff added

proper fix for SRT subtitles using timecodes

comment:6 Changed 10 years ago by tralph

Status: infoneeded_newnew

comment:7 Changed 10 years ago by tralph

Please try newly attached t7515_srt_subtitle_fix.diff patch.

comment:8 Changed 10 years ago by tim@…

I'll need to get around to building a new frontend with and without the new patch and see if the problem is still there and if so if this fixes it.

This may take me a few days...

If the problem is still there I'll make a video clip and a .srt file excerpt.

comment:9 Changed 10 years ago by tralph

Resolution: fixed
Status: newclosed

(In [23744]) Use timecode for time based SRT subtitles instead of frameNumber since fps can vary and frames can be repeated.

Original patch by tim at electronghost dot co dot uk

Fixes #7515.

comment:10 Changed 9 years ago by jari.nevalainen@…

Resolution: fixed
Status: closednew

This still doesn't work with Scandinavian Canal+ channels. Please find an example of a stream from http://www.kennelpoika.net/mythtv There is also a .sub file which was taken from the stream using ProjectX.

comment:11 Changed 9 years ago by robertm

Owner: changed from Janne Grunau to markk
Status: newassigned

comment:12 Changed 9 years ago by markk

Resolution: fixed
Status: assignedclosed

Jari - I've tested your clip and subs file with trunk and as far as I can tell it works without issue. I don't know what version you're running but if you still see this problem with current trunk or 0.24 when it's released, please re-open with a detailed description of the symptoms.

comment:13 Changed 9 years ago by jari.nevalainen@…

I was using 0.23.1. Today I also tried with current trunk and it had the same problem. I had to downgrade back to 0.23 because of WAF (there were some vdpau issues with trunk also). I'll set up another PC with trunk to get you some examples. The problem occurs when there is a lot's of dialogs coming. Some of the text is missing and some is shown such a short time that it's impossible to get it read. This occurs only on Canal+ movie channels (First, Hits, Action, Drama). For example Star and Animal Planet have no problem, even though they are provided by Canal.

Note: See TracTickets for help on using tickets.