Log in

View Full Version : Subtitles and Avis


shevegen
16th August 2004, 14:56
Hi,

an avi movie containing personal video data from family shall get subtitles.
Is this possible unter Linux?

I dont mind to make Hardsubs, either way is fine for me as i will keep the original data also unmodified.

A little example:

50 MB Avi File, length 2 minutes. At every 10 seconds i want to
display a custom .txt file /.srt /.whatever :)
like "Genevre, top view",
"Side view"
"Family Foo playing and frolicking in the fields" ;)

echo
17th August 2004, 13:06
Subtitle files are only text files with special formatting. You could create a new text file with any text editor which would look like this for srt subtitles:
1
00:01:10,000 --> 00:01:12,000
Subtitle line 1
Duration 2 seconds

2
00:01:20,000 --> 00:01:23,000
Subtitle line 2
Duration 3 seconds
The format is: start time --> endtime for each line followed by the text you want your subtitles to have in as many lines as you like.

You can view the subtitles with almost any player in linux (mplayer, VLC, Xine ... ). It would be a good idea to name the subtitles the same as the video file i.e. myvideo.avi and myvideo.srt
These subtitles will not be hardcoded in the video which would be left intact.

shevegen
18th August 2004, 10:16
The problem I imagine is to bring the subtitles into the video :)

Consider it would be an avi file format, i like that an avi is just one file (i have had troubles with my damaged DVDs, where only one vob was scratched because the DVD had ... well ok few scratches. It screwed it all. I imagine since avi's are smaller, though also worse quality, chances are really less likely that they go broken, especially since you could backup them multiple times.)

Now if i can make an avi with subs on linux, i could view it pretty everywhere. But my problem is that i dont know how to bring a sub into an avi permanently by just having one avi file.

echo
18th August 2004, 13:21
I'm not really sure I understand what you want. Do you want to have the subtitles in the avi container and have just one file for both video/audio/subtitles? If that is what you want I do not know of any method native to linux that can put subtitles in avi files. But I think I have seen reports that alexnoe's avimuxgui works fine under wine and it can put srt subtitles in avi container files. I don't know if you can play those under linux though, I've never tried it. But why not use matroska instead of avi? You can put anything you want in it and it will play fine with mplayer etc.

jernst
18th August 2004, 13:36
and if you scratch your media you will still be able to play your matroska file (if you do it with your avi there are good chances that it will be unrecoverable).

evade
20th August 2004, 00:28
Do you want to encode the subtitles into the video?
If so how about something like this:

mencoder -vc ffmpeg12 -ofps 23.976 -o /dev/null -vf crop=720:368:0:54, -aid 128 -ovc xvid -xvidencopts trellis:chroma_me:vhq=4:autoaspect:quant_intra_matrix=/export/scripts/quant_type/xvid-hvs-sixofnine.intra:\
quant_inter_matrix=/export/scripts/quant_type/xvid-hvs-sixofnine.inter:bitrate=2300:pass=1 -oac copy -slang en -dvd-device /raid/dvdrip/SOLARIS_16X9 dvd://1

mencoder -vc ffmpeg12 -ofps 23.976 -o /raid/movies/Solaris.xvid.avi -vf crop=720:368:0:54, -aid 128 -ovc xvid -xvidencopts trellis:chroma_me:vhq=4:autoaspect:quant_intra_matrix=/export/scripts/quant_type/xvid-hvs-sixofnine.intra:\
quant_inter_matrix=/export/scripts/quant_type/xvid-hvs-sixofnine.inter:bitrate=2300:pass=2 -oac copy -slang en -dvd-device /raid/dvdrip/SOLARIS_16X9 dvd://1

This will encode the english subtitles right over the video.

If you you dont mind encoding some black at the bottom of the screen and putting your subs on that you can play with the -vf expand option.

evade
20th August 2004, 03:11
Sorry, I just Realized that you want to do this with subtitles you have created or will create.


Simple enough.

Create the srt file as echo suggested

Verify that they look the way you want like this:

mplayer -sub mysubs.srt source.avi

and then encode like this:

mencoder -ovc whatever -oac whatever -sub mysubs.srt -o myencodedvideo.avi source.avi

shevegen
20th August 2004, 12:01
Thanks a lot for the help guys!

Also I completely forgot about Matroska, have yet to learn more there.

EDIT: Sure enough, Mplayer (suite mencoder etc...)seems to be the best solution right now under Linux for many video related things.