#9103 closed enhancement (wontfix)

srt subtitles fails to be read if numbering not present

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

Description

Summary of the bug:

How to reproduce:

In the same folder:

1/ Take some video: VIDEO.mkv

2/ Create a srt text file (utf8) SUBTITLES.srt as such:

00:00:03,000 --> 00:00:04,000
Some subtitle 1

00:00:05,000 --> 00:00:06,000
another one

00:00:10,000 --> 00:00:12,000
last one

ffplay -vf subtitles=filename="SUBTITLES.srt" "VIDEO.mkv"

When you watch you do no see subtitles, this is because the srt files does not contain the expected numbering before the timecodes.

ffplay is not tolerant on this lacking, while VLC or Mplayer render the expected result, as time codes are well formated.

PROPOSED FIX:
https://en.wikipedia.org/wiki/SubRip#File_format

ffplay ought to auto-increment a counter at each new line time code as it iterates on reading the subtitles file.

Additionaly the raised error does not pinpoint to the potential issue:
Unable to open 2014-07-30_demo.srt
Error initializing filter 'subtitles' with args 'filename=2014-07-30_demo.srt'

Thanks for improving this to allow to render the subtitles.

Below such a case execution example:

ffplay -vf subtitles=filename="2014-07-30_demo.srt" "2014-07-30_demo.mp4"
ffplay version n4.3.1 Copyright (c) 2003-2020 the FFmpeg developers

built with gcc 10.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2014-07-30_demo.mp4':0/0

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
genre : Dance Bachata
title : 20140730_demo
encoder : Lavf55.50.100

Duration: 00:03:34.67, start: 0.000000, bitrate: 1062 kb/s

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x762, 956 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:

handler_name : VideoHandler

Stream #0:1(eng): Audio: mp3 (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 100 kb/s (default)
Metadata:

handler_name : SoundHandler

[Parsed_subtitles_0 @ 0x7f0798156a00] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[Parsed_subtitles_0 @ 0x7f0798156a00] Unable to open 2014-07-30_demo.srt
Error initializing filter 'subtitles' with args 'filename=2014-07-30_demo.srt'

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

Change History (5)

comment:1 by Nicolas George, 17 months ago

What software produce subtitles without numbering?

comment:2 by Carl Eugen Hoyos, 17 months ago

Keywords: srt added; ffplay ffmpeg subtitles removed
Priority: normalwish

comment:3 by artofit, 17 months ago

What software produce subtitles without numbering?

Does it matter?

Anyone can type an srt file with any text editor, just as one can type html, css, code, etc.

comment:4 by Nicolas George, 17 months ago

Yes, it does matter.

If a common software is spewing badly formatted files, then these files will be found around, and supporting them has a rather high priority.

If no common software is polluting an environment that is already very polluted by nonstandard files, we have no reason to. Remember that supporting badly formatted files has a cost: it makes detection more ambiguous.

So: just write the numbers. Apply the first half of the Postel principle to yourself. Whether we decide to apply the second half on our side is none of your concern if you do.

comment:5 by Carl Eugen Hoyos, 17 months ago

Resolution: wontfix
Status: newclosed

Please reopen if such files were not just created by accident with a text editor but by some subtitling software.
FFmpeg is known to be lenient recognizing and reading files but files that contradict a specification should not necessarily detected and read.

Note: See TracTickets for help on using tickets.