[MPlayer-users] Make a clip with subtitles?

Bill Crockett wsc4 at optusnet.com.au
Sat Apr 7 12:02:01 EEST 2018


From: "Eli the Gearded" <mplayer at eli.users.panix.com>
Sent: Saturday, April 07, 2018 6:49 AM


> Just for background let me give a short description of what I'm doing
> and why.
>
> I watch digital files with mplayer and note the approximate time of
> interesting things. Later I extract video clips from around that time,
> start 5 seconds before, and grab clip of 20 seconds.
>
> mencoder -ss $ss  -endpos $td \
>        -vf harddup -nosound -ovc copy -noskip -mc 0 \
>        "$in" -o "$out"
>
> Then I play the clip to make sure it has what I want, otherwise adjust
> the $ss and $td values. Next from that smaller clip, I extract the
> frames (this time "$in" is the "$out" of the previous step):
>
> # START and DURATION are typically empty, when not empty they are
> # "-ss TIME" and "-endpos TIME2"
> mplayer $START $DURATION -nosound -vo "jpeg:outdir=$outdir" "$in"
>
> Finally I review the frames and select some to make a GIF. I have this
> two-step process because video -> frames is really slow, while video ->
> video is fast. The clip from the first stage might not be good, but I
> can make it and preview it, and then make a second one FASTER than I
> can extract the frames from the original and check those.
>
> Given that workflow, I'd like to know what I can do to make substites
> appear (when I have them) in the final frames. Can mencoder create the
> soundless clip with the substitles written into the video stream? I've
> played around trying to get that to work, but never figured out the
> options.
>
> Baring that, if I made a subtitle file for my soundless clip (and I
> probably could automate that easily with a program), can I get the
> second stage to composite the subtitles in before writing the JPEG
> frames out? What options would I need?

I would run some tests with your final video of 20 seconds or what ever.

mplayer -sub sub.srt input

"sub.srt" is a textfile of timimgs and subtile text and looks something like 
this:

----------------------------------------------

1
00:00:01,000 --> 00:00:03,990
This is 1 to 3 seconds

2
00:00:06,000 --> 00:00:07,990
This is 6 to 7 seconds

3
00:00:11,000 --> 00:00:14,090
This is 11 to 14 seconds

4
00:00:16,000 --> 00:00:20,000
This is 16 to 20 seconds

---------------------------------------------

Copy the text (in-between the dash line). Name it as sub.srt and run it to 
see if it works.  Adjust timing and text to your needs.  Run MEcoder 
with -sub sub.srt

For colours, borders, scale, you can put in these if you want:

-vf ass -ass -ass-border-color -ass-color -ass-font-scale.  Color has the 
format of rrggbbaa

BTW, why did you not post this at: 
https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users ? 



More information about the MPlayer-users mailing list