4

So I've downloaded the free fan-created Star Trek Continues Blue-Ray ISO for Episodes 1-3 and I'm trying to convert the FHD 1920x1080 to SD 960x540 to be able to watch on my phone:

ffmpeg -canvas_size 960x540 \
-i /media/STC_VOL1_BR/BDMV/STREAM/00000.m2ts \
-map_metadata -1 \
-c:v libx264 -map 0:0 -strict -2 -r 24 -s 960x540 \
-c:a libmp3lame -map 0:1 -b:a 384K \
-metadata:s:s:0 language=EN -c:s dvdsub -map 0:2 \
/media/Videos/Star\ Trek\ Continues/S01E01\ Pilgrim\ Of\ Eternity.mkv

but after a few seconds of watching the converted mkv, the subtitles become:

  • unreadable due to overlapping
  • are slightly big (no issue)
  • shifted to the right and bottom of the screen

VLC Screenshot

What am I doing wrong?

Note: I've only ever dealt with srt subtitles and I know that dvdsubs are images, so that's why I thought the canvas_size parameter might be of help, but it makes no difference.

  • 1
    I joined this site for the sole purpose of upvoting this excellent question :) – WinEunuuchs2Unix May 31 '19 at 22:40
2
+50

Technically the cleanest look with these subtitles would be to:

  1. Extract the subtitles
  2. Turn them to text using your favourite OCR application
  3. Carefully review and edit the text
  4. Burn them back into the media stream in the size, colour, orientation and format of your choice

This is a large and time consuming job which I have personally undertaken in the past but is probably overkill in this case.

The better option is to simply add in the FFmpeg option -fix_sub_duration (placed before the input file options) and this will fix the doubled up subtitles as I illustrate below, and make the subtitles easily readable:

enter image description here

The details of the -fix_sub_duration option can be found in the FFmpeg-all man pages but I have taken the liberty of quoting these details here:

-fix_sub_duration

Fix subtitles durations. For each subtitle, wait for the next packet in the same stream and adjust the duration of the first to avoid overlap. This is necessary with some subtitles codecs, especially DVB subtitles, because the duration in the original packet is only a rough estimate and the end is actually marked by an empty subtitle frame. Failing to use this option when necessary can result in exaggerated durations or muxing failures due to non-monotonic timestamps.

Note that this option will delay the output of all data until the next subtitle packet is decoded: it may increase memory consumption and latency a lot.

You will note that this is the first of the Advanced Subtitle options, the second being the -canvas_size that you have already used...

  • Welcome! Hopefully this is your first of many awesome, thorough, helpful answers! – Michael Liebman Jun 5 '19 at 23:02
1

You can not resize bitmap subtitles like dvdsub currently with ffmpeg utility. The best solution is to convert bitmap subtitles to textual one, and for that use Subtitle Edit tool.

  • Could you please edit your answer and give a more specific solution? (all example files are all freely downloadable.) I'm looking for an answer that is at least as specific as the question, including installation instructions on the new utilities I need if ffmpeg cannot do what's requested. – Fabby Jun 2 '19 at 12:42
  • I updated answer, I think everything you need is already in answer. with little searching you can do what you want/need. – Paul B. Mahol Jun 3 '19 at 7:57
  • @Fabby Looks like Subtitle Edit will run well enough under Wine: appdb.winehq.org/… – andrew.46 Jun 3 '19 at 10:10
  • I will not discuss with you on such level, also its bad that its only for Windows, there are numerous technical reasons why this can not be done currently with ffmpeg alone. – Paul B. Mahol Jun 3 '19 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.