[FFmpeg-user] Strange newline character in mkv subtitles

Krzysztof kite at interia.pl
Fri Sep 21 00:16:17 CEST 2012


I encountered a weird problem and I have no idea what am I doing wrong.

I have a number of MKV files with subtitle stream that play well in mplayer or
on my Blueray player (Yamaha BD667). But when I try to add a subtitle track to a
MKV file using ffmpeg, the subtitles work fine in mplayer, but on my Blueray
player I see a rectangle character instead of a newline. Every subtitle is shown
in one line with rectangles instead of new lines.

Here's what I tried:

Convered the SRT file to UFT-8:
# iconv -f CP1250 -t UTF-8 -c original_subtitles.srt >subtitles.srt

Tried both dos2unix or unix2dos on the subtitles.srt

Muxed the subtitles with the video:
# ffmpeg -i video.mp4 -i subtitles.srt -acodec copy -vcodec copy -scodec copy
video.mkv

The result looks the following:
Input #0, matroska,webm, from 'video.mkv':
  Metadata:
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    CREATION_TIME   : 2012-07-04 12:30:40
    ENCODER         : Lavf53.32.100
  Duration: 01:42:34.63, start: 0.000000, bitrate: 303 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p, 366x270
 [SAR1:1 DAR 61:45], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      CREATION_TIME   : 1970-01-01 00:00:00
      LANGUAGE        : eng
      HANDLER_NAME    : VideoHandler
    Stream #0:1(eng): Audio: aac, 44100 Hz, stereo, s16 (default)
    Metadata:
      CREATION_TIME   : 2012-07-04 12:30:44
      LANGUAGE        : eng
      HANDLER_NAME    : GPAC ISO Audio Handler
    Stream #0:2: Subtitle: text (default)

For comparison a working video is:
Input #0, matroska,webm, from 'movie.mkv':
  Duration: 02:25:29.89, start: 0.000000, bitrate: 575 kb/s
    Chapter #0.0: start 0.097000, end 8729.899000
    Metadata:
      title           : 00:00:00.097
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1088x448 [SAR 329:340 
DAR47:20], SAR 239:247 DAR 4063:1729, 23.98 fps, 23.98 tbr, 1k tbn, 47.95
tbc (default)
    Metadata:
      title           : xxxxx
    Stream #0:1: Audio: aac, 48000 Hz, stereo, s16 (default)
    Metadata:
      title           : xxxxx
    Stream #0:2: Subtitle: text (default)
    Metadata:
      title           : xxxxx

I even went as far to look in the hexdump for the subtitle string and compared
the newline characters in both MKV files. In both cases I see 0d 0a as a newline
separator. The difference is that the ffmpeg muxed file the subtitle is
terminated by 0d 0a 0d 0a, whereas in the other file there no newline at the end.

Used ffmpeg 0.10.4.

Again, the strange this is that mplayer shows the sustitles correctly, Yamaha BD
player does not.

Any help appreciated!



More information about the ffmpeg-user mailing list