mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.51k stars 2.92k forks source link

The Bilingual (primary and secondary) subtitles at the same time on a terminal #10118

Open vegan19 opened 2 years ago

vegan19 commented 2 years ago

Is there a way to edit that part of the code in player mpv (player/sub.c): So the terminal can show primary --sid=1 and secondary --sid=2 and third --sid=3 and fourth --sid=4 subtitles at the same time on a terminal? When I run (with video) I can see primary and secondary subtitles in video. mpv --sid=auto --secondary-sid=auto But when run (see only primary subtitles on a terminal): mpv --sid=auto --secondary-sid=auto --no-video

The original source code (player/sub.c):

    // Handle displaying subtitles on terminal; never done for secondary subs
    if (mpctx->current_track[0][STREAM_SUB] == track && !mpctx->video_out) {
        char *text = sub_get_text(dec_sub, video_pts, SD_TEXT_TYPE_PLAIN);
        term_osd_set_subs(mpctx, text);
        talloc_free(text);
    }

I changed to that:

    // Handle displaying subtitles on terminal; never done for secondary subs
      if (mpctx) {
    printf("\n");
        char *text = sub_get_text(dec_sub, video_pts, SD_TEXT_TYPE_PLAIN);
        term_osd_set_subs(mpctx, text);
        talloc_free(text);
    }

But when I change to that, work not so well and good, and only possible to show 2 subtitles in same time

changed code

Dudemanguy commented 9 months ago

This is an old one but as you found the terminal purposely does not print secondary subtitles. This could be changed. I don't see the practical use in going over two though.