View Full Version : How do I add a subtitle track to an existing DVD (VIDEO_TS folder format)?
I have a VIDEO_TS folder containing a backup of a foreign language DVD (done with k9copy, just the main feature, no menues or extras), I also have an english .sub subtitle file for this movie (downloaded from some web site), can anyone suggest a procedure how to add this subtitle track to the existing ifo/vob file structure using Linux?
I would like to keep this in the VIDEO_TS format, and not affect the audio and video tracks, no conversion to avi or mkv or similar.
I guess I somehow have to demux the vobs into audio and video files, then convert the subtitle file into vob format and remux everything together again, or is there an easier way to just add the subtitles into the exsisting vobs?
What program(s) can do this? GUI or CLI, I don't mind, actually I even prefer CLI.
Any pointers to a how-to for this would be welcome too, I couldn't find any.
Many thanks in advance for any suggestions.
Mac The Knife 01-23-09, 03:17 PM Mencoder (a CLI) can do what you want. I've never actually done this, but subtitles use the same mechanize as buttons in the menus and I have done that.
You should be able to do this without demuxing the audio and video and without reencoding. However, all the times that I've created menus, I've started out with separate audio and video files, so I'm not absolutely certain of that point.
I don't have my notes handy right now. I'll look through them tonight and see if I can come up with something more for tomorrow.
Many thanks any help is appreciated, I will look into Mencoder, but if you have any related notes please post them, it would make life easier!
BTW, I don't want a subtitle choice menu, I just want to add the subtitle stream to the existing video and audio stream which are in VIDEO_TS (ifo/vob) format.
I don't need to be able to select the subtitles from a menu, I just want to be able to select it by pressing the subtitle buttom on the remote of my DVD player and the equivalent function on software DVD players.
Please consider also that the downloaded subtitle file I have is in .sub (MicroDVD) format so it will need to be converted into the vob subtitle format unless Mencoder does that too.
SeijiSensei 01-24-09, 09:02 AM I know you're committed to the vob format, but I do think you'd have better luck muxing the video, audio, and subtitle streams into the Matroska container. mkvtoolnix (http://www.bunkus.org/videotools/mkvtoolnix/) provides the tools you need, and copies are available from the repositories of all major distros.
The forums at Doom9 and AnimeSuki might have more help.
Mac The Knife 01-24-09, 02:15 PM OK. I'm not sure if I can (painlessly) get you from vob->vob w/subtitles.
I'm certain one of these two methods will painlessly get you from vob-> mepg2ps w/subtitles.
Anyway here's a couple of things to try. Let's see what you get and go from there.
==========================================================
METHOD 1:
You might be able to use the following options in mencoder, but I've never used them so I'm not sure how they work:
-vobsubout <basename>
Specify the basename for the output .idx and .sub files.
This turns off subtitle rendering in the encoded movie and diverts it to
VOBsub subtitle files.
-vobsuboutid <langid>
Specify the language two letter code for the subtitles. This overrides what is read from the DVD or the .ifo file.
-vobsuboutindex <index>
Specify the index of the subtitles in the output files (default: 0).
So the mencoder command would look something like the following:
mencoder -oac copy -ovc copy -of mpeg -vobsubout "YOURSUBFILE" \
-mpegopts format=mpeg2:tsaf -vf scale=-1,harddup \
-o "NEW.vob" "ORIGINAL.vob"
Where:
-oac copy tells mencoder to copy the audio stream (i.e. don't reencode)
-ovc copy tells mencoder to copy the video stream (i.e. don't reencode)
-of mpeg tells mencoder to use mpeg2 format for the output file (should be the same as vob)
-vobsubout tells mencoder the name of your subtitles file
-mpegopts tells mencoder to use the following options when generating the output file
format=mpeg2:tsaf use mpeg2 and time stamp all frames (it does this without reencoding)
if the timestamping works on your files you'll want it although it
sometimes fails for me. It makes skipping forward and backward work
much better when all the frames are time stamped.
-vf scale=-1,harddup do not rescale the video. harddup has something to do with frame
duplication and dropping which I really don't understand, but you'll
usually want it.
-o tells mencoder the name you want for the output file
"ORIGINAL.vob" is the name of your original vob file
I don't think you'll need the "-vobsuboutid" tag, your sutitles will just show up as "unspecified" instead of having a two letter language code and you shouldn't need "-vobsuboutindex" since you'll want your subtitles to be default 0 anyway.
==========================================================
METHOD2:
If mencoder doesn't work for you, you might want to try something more like creating menu pages using the spumux command (this is the method I was originally thinking you might use, but mencoder will be simpler if you can get it to work).
The command I actually use to generate menus is the following:
mplex -f 8 -o /dev/stdout genmenu.m2v sound.mpa | spumux -m dvd -v 2 GENMENU.xml > genmenu.mpg
You should be able to ignore all the junk to the left of the pipe operator since all that is doing is taking my seperate audio and video files (genmenu.m2v and sound.mpa), muxing them together and piping them into the spumux command. If spumux will take your vob file directly then you should be able to do something like the following:
spumux -m dvd -v 2 SUBTITLES.xml < ORIGINAL.vob > NEW.vob
Where:
-m dvd tells it to do dvd style encoding
-v 2 just sets the vebosity level
SUBTITLES.xml is an xml file you'll have to create that specifies the subtitle filename and a bunch of options
< ORIGINAL.vob specifies your original vob filename
> NEW.vob is the name of the output file
Here’s a sample xml configuration file (I copied it from the man page):
<subpictures>
<stream>
<textsub filename="demo1.srt" characterset="ISO8859-1"
fontsize="28.0" font="arial.ttf" horizontal-alignment="left"
vertical-alignment="bottom" left-margin="60" right-margin="60"
top-margin="20" bottom-margin="30" subtitle-fps="25"
movie-fps="25" movie-width="720" movie-height="574"
force="yes"
/>
</stream>
</subpictures>
Those are all the defaults, so unless you want to change them you should be able to do a minimal file that just specifies the filename of your subtitles the correct frame rate and size (and perhaps force="no" if you don't want forced subtitles):
<subpictures>
<stream>
<textsub filename="SUBTITLES.sub"
subtitle-fps="30" movie-fps="30"
movie-width="720" movie-height="480"
force="no"
/>
</stream>
</subpictures>
I'm not sure where your vobs came from, so I'm not sure if the frame rate and size is correct. The defaults were for PAL. The correct rate values might be 24 instead of 30. The spumux man page doesn't say if they want NTSC rate or the film rate.
Hopefully that will get you started. Spumux supports a bunch of different subtitle file formats but if your format is not supported then I'm afraid I won't be able to help.
If mencoder or spumux won't take vobs as input files ( I think they will, but I'm not 100% certain) then I can help a little bit with demuxing and with remuxing.
Or if mencoder or spumux won't output vobs ( I think they will, but I'm not 100% certain) then I can help a little bit with taking the mpeg2 ps files (which I am 100% certain they can create) and using dvdauthor to generate vobs (actually the entire set of dvd files, vobs, ifos, etc).
If you don't really need vobs and can live with mpeg2 ps files (which are essentially just vobs without the chapter marks) then I suggest you go that route.
[ed: I just reread your post and realized you're in the UK so perhaps those PAL default values are really what you want and you won't need to specify rate and size in the XML file.]
mythmaster 01-24-09, 02:41 PM I wonder if avidemux would work? --> http://fixounet.free.fr/avidemux/
Mac The Knife 01-24-09, 02:58 PM I use avidemux occasionally for clipping up ATSC streams (actually I usually use HDTVtoMPEG2 for clipping because I prefer the user interface).
I haven't noticed any capability in avidemux to add subtitles to a stream, but I wasn't looking for it either.
waterhead 01-24-09, 03:21 PM There is a program named spumux for adding subtitles to a mpeg2 program.
http://dvdauthor.sourceforge.net/doc/spumux.html
It can be used in conjunction with the dvdauthor program. I know that if you use the 'Q' DVD-Author GUI, it has the options to add a subtitle file. The one time I did this, the subtitle file came as a .srt file.
mythmaster 01-24-09, 03:22 PM I think it can --> http://www.avidemux.org/admWiki/index.php?search=subtitle&go=Go
Thanks for all your suggestions, I have been looking into spumux which really seems to be the tool that could do what I want, but I still havent gotten far.
I have the following:
a downloaded subtitles file 'movie.sub' which I have also converted into srt with sub2srt, this wasn't really necessary as submux seems to take either, but I find the srt format timevalues more readable for checking that it really matches the soundtrack timings of the DVD.
Then I have the VIDEO_TS/ folder with the following:
-rw-r--r-- 1 a a 12288 2009-01-24 20:16 VIDEO_TS.BUP
-rw-r--r-- 1 a a 12288 2009-01-24 20:16 VIDEO_TS.IFO
-rw-r--r-- 1 a a 79872 2009-01-24 20:15 VTS_01_0.BUP
-rw-r--r-- 1 a a 79872 2009-01-24 20:15 VTS_01_0.IFO
-rw-r--r-- 1 a a 1073709056 2009-01-24 20:15 VTS_01_1.VOB
-rw-r--r-- 1 a a 1073709056 2009-01-24 20:15 VTS_01_2.VOB
-rw-r--r-- 1 a a 1073709056 2009-01-24 20:16 VTS_01_3.VOB
-rw-r--r-- 1 a a 1073709056 2009-01-24 20:16 VTS_01_4.VOB
-rw-r--r-- 1 a a 694474752 2009-01-24 20:16 VTS_01_5.VOB
This contains purely one Title with one Video stream (17 chapters), 1 Italian Audio stream and 2 German Subtitle streams, no menues or extras (as I intentionally removed them with k9copy when doing the backup of the DVD).
I also created a simple sub.xml for submux:
<subpictures>
<stream>
<textsub filename="movie.srt"
/>
</stream>
</subpictures>
Now submux wants a mpeg2 file as input and generates a mpeg2 as output, but I have vobs!
I know vobs contain mpeg2 streams but afaik they are not just a plain mpeg2 stream.
I tried the following but as expected that din't really work:
spumux -s 2 -v 5 -P sub.xml < VTS_01_?.VOB > movie.mpeg2
Do I have to extract all single components (the video, audio and 2 subtitle streams) out of the exsisting VOBs (maybe with tcextract or mplayer) and then combine them back all together with submux and dvdauthor?
What I don't get is, why does submux take a mpeg2 file as input and produces again a mpeg2 file as output, I thought mpeg2 files are just plain video files, only vobs can contain subtitle streams?
I also looked at Avidemux but I couldn't find anything to add subtitle streams, only to extract them.
Same for mencoder, I might have misunderstood something, but doesn't -vobsubout extract the subtitle streams, rather than merge them in?
I'm still looking into this further but at the same time help is very welcome.
mythmaster 01-24-09, 08:56 PM I also looked at Avidemux but I couldn't find anything to add subtitle streams, only to extract them.
It looks like there's a video filter called subtitler for avidemux that will permanently burn subtitles onto your video (i.e., can't be turned on or off), so I don't know if that's acceptable for you. The wiki page is here --> http://www.avidemux.org/admWiki/index.php?title=Video_filter_Subtitler
According to the vobsub filter wiki page (http://www.avidemux.org/admWiki/index.php?title=Video_filter_VobSub), "There is not yet a section in the documentation about adding soft subtitles in Avidemux.", so it may be possible. Searching through and asking on their forums would probably yield you some good info. Avidemux forums --> http://www.avidemux.org/admForum/
I would prefer a normal optional subtitle track, not permanently burned into the video track.
I seem to be getting somewhere with spumux!
I used dvdunauthor to decode the dvd, then merged all 17 vobs (I got one for each chapter) with a simple:
cat vob_01t_0??.vob > vob_01t_all.vob
then ran:
spumux -m dvd -s 2 -v 1 -P sub.xml < vob_01t_all.vob > vob_01t_allnew.vob
If I play this vob with xine now, it still has the video, audio and 2 subtitle tracks it had originally, but it also has a third subtitle track which is the one I added from the sub.xml which contains a pointer to the downloaded .sub.
The only problem is that the added subtitle track is almost unreadable, as the font is very dark-grey with a black outline, on black background it's all but invisible...
Now if I only knew how to fix the subtitle colors generated by spumux or better how to generate them correctly in the first place...
See attached snapshot, it contains 2 subtitle lines, the lower one is practically unreadable.
Actually there is still something wrong, the subtitles are all at the wrong times (not time shifted but all random), I guess that's because of the way I merged all the vobs into one...
With mplayer the subtitle colors looked even correct, no color problems as seen with xine.
waterhead 01-25-09, 10:05 AM I was checking how QDVDAuthor makes the subtitles, using spumux. I was hoping for some info that would help you out.
It seems that is takes the text .srt file and creates a series of .png files that contain the subtitle text. QDVDAuthor has options to change the font, color, background and shadow. I think having a background or shadow is what would help it stand out.
It then takes the .png files and makes a subtitles.vob file, and this is somehow included in the final DVD. I couldn't find the exact spumux commands for when it creates the .png files, though.
It still isn't perfect, as these two screenshots show. These are from the movie Watermelon Man (http://en.wikipedia.org/wiki/Watermelon_Man_(film)).
Mac The Knife 01-25-09, 03:45 PM I would prefer a normal optional subtitle track, not permanently burned into the video track.
...
In that case, you'll want to add the "force=no" option to the xml file.
Although it will probably be easier to keep 'forcing' subtitles until you have everything else working properly.
Now if I only knew how to fix the subtitle colors generated by spumux or better how to generate them correctly in the first place...
....
I've never dealt with '.sub' files. But if GIMP can read and write them then that might be a way to change the colors. I use GIMP to generate the ".png" files for my menu buttons that are then passed into spumux.
I'm guessing that QDVDauthor is calling something like "imagemagik" (sp???) to convert the ".srt" to ".png" and then passing the .png files to spumux.
You're beyond my level now. I hope it works out for you since I started you down this path. :o
.sub and .srt are actually plain text subtitle files, spumux converts them to bitmaps when adding them to the mpeg stream.
I played around with spumux further and also with qdvdauthor yesterday, but without satisfactory results.
I'm starting to think I should just convert the DVD into an mkv and keep the subtitles as a separate .srt file as the Popcorn Hour should be able to deal with that (haven't tried it yet but it says so in the specs) and (g)mplayer has the option to use a separate subtitle file too.
I'm becoming less enthusiastic about VIDEO_TS format, as it's not really an open standard, that's probably why there is no Linux software that supports it fully, dvdauthor is very good but it doesn't support the full specs, while the mkv format is completely open and therefore fully supported by Linux software tools, as far as I know.
Don't know if this will do what you need, but it sure looks purdy ;)
Gnome Subtitles
http://gnome-subtitles.sourceforge.net/screenshots
|
|