srt-mux show second srt at top
0-MegaMind-0 opened this issue ยท 4 comments
I was trying this out but the merged subtitle looks too crowded
The source shows bottom.srt
at bottom of screen and top.srt
at top which looks much cleaner
would it be possible to add a similar option for srt-mux?
pretty much add {\an8}
to all lines in top.srt
https://subtitletools.com/merge-subtitles-online
this site already does same thing but i'd like to automate this with my script
Thanks for the suggestion! I think 62fa170 should do it, and works for me in mpv. Can you try it out and report back? :-)
I wrote a workaround in my script yesterday but this works much better.
but maybe change this from
"Merge subtitles, with one on top and one at the bottom": "srt mux -t -i eng.srt -i chs.srt -o both.srt",
to
"Merge subtitles, with one on top and one at the bottom": "srt mux -t -i top.srt -i bottom.srt -o both.srt",
to avoid any confusions since from what i checked the order matters.
Thanks a lot :)
Oh yeah, that's true. Thanks!
sorry for extra questions
is it currently possible to use srt-mux inside a python program using import?
my program currently writestopsrt
totop.srt
andbottomsrt
tobottom.srt
to files and then runs./srt-mux
command in shell to mux them
is it possible to just directly use srt mux in my script without needing to write it into files and then execute srt mux?
sorry for the trouble i'm very new to programming and didn't see something similar in docs
i tried to borrow few things from srt-mux into my script
top = req.get(url).content bottom = req.get(url_two).content muxed_subs = [] for idx, subs in enumerate([top, bottom]): for sub in subs: if idx % 2 == 0: sub = r"{\an8}" + sub print(sub) else: sub = sub muxed_subs.append(sub) output = srt_tools.utils.compose_suggest_on_fail(muxed_subs)
and few more things but i always some or the other error
sorry for all the trouble and thanks for your work i got it working
i borrowed a few things and figured out what i was doing wrong
final code looks like this and works exactly as same as ./srt-mux -t -i top.srt -i bottom.srt -o out.srt
top = req.get(top_srt_url).content
bottom = req.get(bottom_srt_url).content
top = srt.parse(top.decode('utf-8'))
bottom = srt.parse(bottom.decode('utf-8'))
muxed_subs = []
for idx, subs in enumerate([top, bottom]):
for sub in subs:
if idx % 2 == 0:
sub.content = sub.content
else:
sub.content = r"{\an8}" + sub.content
muxed_subs.append(sub)
output = srt_tools.utils.compose_suggest_on_fail(muxed_subs)
open('out.srt', 'wb').write(output.encode())