#11677 closed defect (fixed)
ffplay does not properly sync LRC subtitles with 3-digit milliseconds
| Reported by: | gbr | Owned by: | Kacper Michajłow <kasper93@gmail.com> |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | unspecified | Keywords: | lrc |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
LRC subtitles that use 3-digit millisecond in time tags, cause syncing issues with ffplay.
How to reproduce:
Save the following as subs.lrc:
[00:00.660] We knew the world would not be the same. [00:05.580] A few people laughed, a few people cried, most people were silent. [00:17.030] I remembered the line from the Hindu scripture, the Bhagavad-Gita. [00:25.660] Vishnu is trying to persuade the prince that he should do his duty, and to impress him [00:38.310] takes on his multi-armed form and says, “now I am become Death, the destroyer of worlds.” [00:50.380] I suppose we all thought that, one way or another.
Now use ffplay to reproduce the test video using the above subs.lrc:
ffplay -vf subtitles=subs.lrc https://www.atomicarchive.com/media/videos/media/oppenheimer-quote.mp4
You will notice that the subtitles do not sync properly with the video.
However, if you remove the trailing zeros in the fractional timestamps (i.e. [00:00.660] -> [00:00.66]), then the subtitles will sync properly with the video.
Change History (11)
comment:1 by , 12 months ago
comment:2 by , 12 months ago
Although logical, it does not seem to be a known variant of the format. Can you quote any software that plays it correctly? Also, how did you acquire this file?
comment:3 by , 12 months ago
Seems there are files in the wild with milliseconds and some other software do support this https://getmusicbee.com/forum/index.php?topic=31886.msg176124#msg176124 so we might add support for it too.
comment:4 by , 12 months ago
Is there reference of LRC format where milliseconds are mentioned?
Not that I could find...
Can you quote any software that plays it correctly?
Jellyfin (https://github.com/jellyfin/jellyfin), a popular media player, uses a third-party library called LrcParser (https://github.com/karaoke-dev/LrcParser) for manipulating LRC files, where that format is supported.
Also, how did you acquire this file?
The file was actually generated by a program called Chronograph (https://github.com/Dzheremi2/Chronograph), which generates them with milliseconds by default. It's not popular like Jellyfin though, plus they probably use their own LRC parser: https://github.com/Dzheremi2/Chronograph/blob/1c4afa88b15e29a7dadec93770407b0c16ea3392/chronograph/utils/parsers.py#L185
Lastly, LRClib (https://lrclib.net/), which is likely the largest open source database of LRC files we currently have, probably has some subtitles with milliseconds, because their software to write and download LRC files from that database, called LRCGET (https://github.com/tranxuanthang/lrcget) supports submitting subtitles in that format as well.
comment:5 by , 12 months ago
Should be fixed by https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20025
Do you also need muxer for those?
comment:6 by , 12 months ago
Should be fixed by https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20025
Thank you very much for the quick fix!
Do you also need muxer for those?
Sorry, I'm not sure what that means, but if you think that would help software like mpv (which relies on FFmpeg to render LRC subtitles, based on what I read), then yes, please.
comment:7 by , 12 months ago
Please fix it in a way that will not require fixing again when somebody comes up with a file with four digits.
Also, you might as well take the occasion to factor this code: IIRC, %1[-] or something close to it can be used to scan the optional minus sign.
comment:9 by , 12 months ago
comment:10 by , 12 months ago
| Component: | undetermined → avformat |
|---|---|
| Status: | new → closed |



Why you think this should be supported? Where did you get those subtitles?
LRC timestamp is
[MINUTES:SECONDS:CENTISECONDS].It's possible to support milliseconds. Currently the only format supported is the above one.
Is there reference of LRC format where milliseconds are mentioned?