[FFmpeg-trac] #7362(avcodec:new): Newline in subtitles: sub.ass - CRLF and sub.srt - LF
FFmpeg
trac at avcodec.org
Sun Feb 10 12:07:18 EET 2019
#7362: Newline in subtitles: sub.ass - CRLF and sub.srt - LF
--------------------------------------+-----------------------------------
Reporter: KnightDanila | Owner:
Type: enhancement | Status: new
Priority: wish | Component: avcodec
Version: git-master | Resolution:
Keywords: ass srt | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
--------------------------------------+-----------------------------------
Comment (by beroal):
Replying to [comment:1 cehoyos]:
> Replying to [ticket:7362 KnightDanila]:
> > Picture 1 - sub.ass has CRLF newline style
> > Picture 2 - sub.srt has LF newline style
>
> Why do you believe that one of them is wrong?
> > Can you add option -eol to choose the newline style
>
> Wouldn’t such an option allow to write invalid files?
I recently extracted text subtitles from "mkv" on Linux, and the result
has a mix of "\r\n" and "\n" line ends which is clearly incorrect. So
"ffmpeg" *already* produced an incorrect file, see below.
{{{
0000000 1 \n 0 0 : 0 0 : 0 1 , 4 4 3 -
0000010 - > 0 0 : 0 0 : 0 4 , 5 3 6 \n
0000020 342 231 252 M e e t
0000030 R e b e c c a 342 231 252 \n \n 2 \n
0000040 0 0 : 0 0 : 0 4 , 5 4 7 - - >
0000050 0 0 : 0 0 : 0 7 , 3 3 0 \n
0000060 342 231 252 S h e ' s t h e
0000070 c o o l e s t g i r l \r \n
0000080 i n t h e w o r l d
0000090 , w a i t 342 231 252 \n \n 3 \n 0 0
00000a0 : 0 0 : 0 7 , 4 0 7 - - > 0
00000b0 0 : 0 0 : 1 0 , 5 4 2 \n
}}}
IMHO, there is no need for an option because, according to
http://www.textfiles.com/uploads/kds-srt.txt , lines must end with "\r\n".
So "ffmpeg" must produce "\r\n" for all line ends on all operating
systems.
On the other hand, an option for adding UTF-8 byte order mark would be
useful as some rare programs ("dsrt", for example) require it in UTF-8
text files.
I see that "\r\n" are used between lines of a single subtitle record. I do
not know how text subtitles are stored in "mkv", but I guess that a text
of a subtitle record in the input file uses "\r\n" to separate lines, and
"ffmpeg" inserts "\n" after timing and subtitle record numbers because my
operating system is Linux.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7362#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list