Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Please see this question.

I have just merged two avi files cd1.avi and cd1.avi into movie.avi using:

avimerge -o movie.avi -i cd{1,2}.avi

Problem is that I had to subtitle files linked to the first avi files:

cd1.srt
cd2.srt

At first I tried simply to concatenate the files together:

cat cd{1,2}.srt > movie.srt

But that caused havoc with the subtitles... any suggestions?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

This is pretty trivially done, since .srt files are just text files that contain time stamps -- all you need to do is add the length of cd1.avi to the times of all the subtitles in cd2.srt. You can find the length of cd1.avi with ffmpeg:

ffmpeg -i cd1.avi  # Look for the Duration: line

And then add that to cd2.srt using srttool

srttool -d 12345 -i cd2.srt  # 12345 is the amount to add in seconds

or:

srttool -a hh:mm:ss -i cd2.srt  # The first subtitle will now start at hh:mm:ss

Then you should just be able to concatenate the files together and renumber:

srttool -r -i cd.srt

I picked srttool because in Arch it comes with transcode, which you installed for this question; there are lots of other tools that can shift and merge .srt files too, and at least one website, submerge

share|improve this answer
    
+1 thanks micheal, really appreciate your efforts with my questions –  Stefan Sep 20 '10 at 22:15
    
Thanks! This worked great. Only problem I found is that srttool puts output to the command line. I actually doesn't modify the file you want. A little redirection (>) and WHAMMO, it works perfectly. This has been a huge help and thank you very much. –  user11667 Oct 19 '11 at 4:38

I created this as an online tool a long time ago but lost it due to some problems. I now started to revive this tool and you can find it under http://srtsubmerge.webpgr.com/ it's not quite finished yet but you can hope for improvements or remind me ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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