LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   merge avi with subtitle file ? (https://www.linuxquestions.org/questions/linux-software-2/merge-avi-with-subtitle-file-446766/)

norah_cobain 05-20-2006 01:43 PM

merge avi with subtitle file ?
 
just wondering is there a way to merge avis with subtitle(srt) files ?
using mencoder or soemthing else, so that u know the subs become a part of the avi

the reason i need this is that my parents dvd player plays divx, but doesent support separate subtitle files (and they dont speak englishs so subs are essential)

vegetassj2 05-20-2006 02:43 PM

I think it is possible. In fact, I'm sure of it, but, I don't know a good software to do it... in fact, I don't even know one ^^;;

oldsko0l 05-20-2006 02:51 PM

in windows it is possible, so why shouldn't it be in linux ;)? only I don't know any software for it either, sorry. Post here if you should find any, because I'm curious. :D

vegetassj2 05-20-2006 02:55 PM

Quote:

Originally Posted by oldsko0l
in windows it is possible, so why shouldn't it be in linux ;)? only I don't know any software for it either, sorry. Post here if you should find any, because I'm curious. :D

what's the progs name in Windows than maybe we can run it in wine or cxoffice or cedega?

oldsko0l 05-20-2006 03:15 PM

you can do it with VirtualDubMod
here is a tutorial in dutch maybe you can translate it with the free translator of worldlingo.com
http://ondertitel.com/forum/index.php?showtopic=1789


you can also do it with
# SRT to SSA Convertor ver 1.0
# VirtualDub 1.5.10
# VirtualDub Subtitler Filter

here is tutorial (also in dutch) maybe translate it with worldlingo to
http://ondertitel.com/forum/index.php?showtopic=935


worldlingo free translator link --> http://www.worldlingo.com/en/product...ranslator.html

I hope this was usefull

and you can also just try to search on google for an english tutorial, you know the programs names now, so it can't be so difficult ;)

but I repeat--> this is the windows way! ^^

btw. Post it if you got any luck on linux please? tnx

oldsko0l 05-20-2006 03:23 PM

http://forums.gentoo.org/viewtopic.php?t=117709
I found this on google, there is a part of merging a subtitle in your dvd video maybe it's usefull ;)

norah_cobain 05-21-2006 12:32 PM

thanks for the suggestions, no luck so far, dont wanna install xp-vmware, its such a mess. i have found one solution for linux, that claims to be able to do it, but its not working. its called File2DiVX3Pass 2.1, its supposed to convert to and from different avi formats, and has an option to add a subtitle from a file. trouble is i cant get it to work. maybe i misunderstood how it works, or maybe my sub files are in a wrong format, thers not much documentation available. http://www.geekshop.be/rien/file2div...?page=download

if anyone can get that to work, or has a differnt solution pleas post

oldsko0l 05-21-2006 02:55 PM

I will try, and let you know

oldsko0l 05-21-2006 02:56 PM

but can you add with this program the sub without changing the file-type?

norah_cobain 05-21-2006 03:13 PM

i think u can jsut set the audio and video to 'copy'

oldsko0l 05-22-2006 05:40 AM

it is encoding right now, I'll let you know how it went

oldsko0l 05-22-2006 06:05 AM

no it did not work.. no subtitles were merged..

norah_cobain 05-22-2006 06:20 AM

i emailed the author. heres what he says:

"I just tried one myself, and indeed ... it did not work :( After a bit of
searching and output debugging I came across this problem: mencoder did not
find a TTF file in its path (mine was /home/roet/.mplayer/subfont.ttf but in
your case you should use the correct path).

You can solve this by downloading or copying a TTF font file (located
somewhere on your machine using locate or copy it from a windows machine) to
the specified location (/home/<username>/.mplayer/subfont.ttf). "

havent had the chance to try this yet, but probably will tonight :D

norah_cobain 05-22-2006 09:14 AM

been in touch with the author again, its just not working, he says he might fix the program when/if he has time. however he gave me a little script, and it works!

it looks as follows:
mencoder -vop pp=de,scale=608:336 -oac copy -ovc lavc -lavcopts vhq:vqmin=2:vqmax=2:vme=1:keyint=25:vbitrate=2140:vpass=1 -sub "SUBTITLE_FILE.srt" -o "OUTPUT_MOVIE_WITH_SUBTITLES.avi" "SOURCE_MOVIE.avi"

u need to change the resolution,bitrate etc to match your movie file
:))

EDIT: updated instructions:
----------------------------

from x to divx, subtitle merge:
mencoder -vop pp=de,scale=608:336 -oac copy -ovc lavc -lavcopts keyint=25:vcodec=mpeg4:vbitrate=945:vpass=1 -sub "subtitle.srt" -o "output.avi" "input.avi"

from x to xvid, subtitle merge:
instead of "-ovc lavc " you'd use "-ovc xvid" and the -lavcopts would become obsolete then
more parameters for xvid: http://gentoo-wiki.com/HOWTO_Mencode...ion_Guide#XviD

oldsko0l 05-24-2006 02:28 PM

where do I put this script?

oldsko0l 05-24-2006 02:29 PM

and can't I just copy it? so I won't need to know all those things like bitrate and stuff?

norah_cobain 05-24-2006 03:36 PM

u paste it in terminal after u have edited it in a text editor to match your movie, or alternatively save the text file and make it executable

the bitrate u find by typing mplayer /path/to/original.avi in a terminal, then in hte terminal u will see the bitrate and scale and stuff, which u copy into the script. its a bit messy but it works, and the process is quite fast too, takes me about 20 mins for one movie (on a 2600+ cpu)

oldsko0l 05-24-2006 03:46 PM

but u say from x to divx or x to xvid.. can't I just take from x to x? :P (with x I mean the type it is now)

norah_cobain 05-24-2006 05:09 PM

possibly, i havent found out though..if u find a solution let me know. oh u can take it from xvid to xvid for example but ud still have to enter it into the script, but i dont know a way of automating it so that it goes from x to x without having to enter it in the script if u know what i mean

id also liek to know if theresr a way to keep the original bitrate, resolution etc automaticly without having to check what resolution the original file is for example and then enter that into the script

but im quite happy being able to add subs anyway :D

oldsko0l 05-25-2006 06:21 AM

Code:

[oldsko0l@localhost Domino]$ mplayer Domino\[2005\]DvDrip\[Eng\]-aXXo.avi

Using GNU internationalization
Original domain: messages
Original dirname: /usr/share/locale
Current domain: mplayer
Current dirname: /usr/share/locale

MPlayer 1.0pre7-3.4.4 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon MP/XP Thoroughbred (Family: 6, Stepping: 0)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0

Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system startup scripts.
Opening joystick device /dev/input/js0
Can't open joystick device /dev/input/js0 : No such file or directory
Can't init input joystick
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support.
You will not be able to use your remote control.
Playing Domino[2005]DvDrip[Eng]-aXXo.avi.
AVI file format detected.
VIDEO:  [DX50]  548x222  12bpp  23.976 fps  678.6 kbps (82.8 kbyte/s)
Clip info:
 Software: VirtualDubMod 1.5.10.1 (build 2366/release)
SUB: Detected subtitle file format: subviewer
SUB: Read 1237 subtitles.
SUB: Adjusted 461 subtitle(s).
SUB: added subtitle file (1): ./Domino[2005]DvDrip[Eng]-aXXo.srt
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 80.0 kbit/5.21% (ratio: 10000->192000)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
vo: X11 running at 1024x768 with depth 24 and 32 bpp (":0.0" => local display)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm:ffmpeg (FFmpeg MPEG-4)
==========================================================================
Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
AF_pre: 48000Hz/2ch/s16le
AO: [oss] 48000Hz 2ch s16le (2 bps)
Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
Starting playback...
VDec: vo config request - 548 x 222 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 2.47:1 - prescaling to correct movie aspect.
VO: [xv] 548x222 => 548x222 Planar YV12

this is my output, can u please help me making the script for this movie (for example) so I'll understand where I can find the info for the next time? thanks a lot!

norah_cobain 05-25-2006 07:48 AM

yeah sure, for divx (i havent got around to trying xvid yet):
if your movie is called Domino\[2005\]DvDrip\[Eng\]-aXXo.avi is that the movie name? lets rename it Domino.avi for simplicitys sake.

u need Domino.avi and Domino.srt in the same dir, go to that dir, open a terminal there and paste:
---
mencoder -vop pp=de,scale=548:222 -oac copy -ovc lavc -lavcopts keyint=25:vcodec=mpeg4:vbitrate=679:vpass=1 -sub "Domino.srt" -o "Domino_with_subs.avi" "Domino.avi"
---
voila

u may need to copy a font, like tahoma, or vera sans to your .mplayer dir and rename it subfont.ttf

sorry i got a bit confused regarding the name of the movie file there

oldsko0l 05-25-2006 08:21 AM

tnx man, I really apreciate your effort :)
just some little more questions now

-pp=de what does this mean and where do I find it in my example? (or don't I have to change this?)

-keyint=25 what does this mean and where do I find it in my example? (or don't I have to change this?)

-vcodec=mpeg4 this probably comes from this-->
Code:

Selected video codec: [ffodivx] vfm:ffmpeg (FFmpeg MPEG-4)
is this also mpeg 4 if its a xvid movie?

-vpass=1 what does this mean and where do I find it in my example? (or don't I have to change this?)


I don't want to look lazy but I just want to be shure of these things, u know.. ;)

and how do I check wether the movie is divx or xvid or something else? or will I be able to see it always here
Code:

Selected video codec: [ffodivx] vfm:ffmpeg (FFmpeg MPEG-4)
(I guess this is divx?)

tnx again, norah cobain

norah_cobain 05-25-2006 08:27 AM

i dont know what the pp=de and the other things mean, i just know it works with these things included in the script. dont know what would happen if u remove them. u dont have to change any of these afaik, i thnik u only have to change the filenames, resolution and bitrate to match your movie. the codec things ur asking about, i dont know, its just what ive been told, i dont even know if its correct. ive been told FFmpeg = divx. if its a xvid its probably something else...not sure

u can check what codec a movie is by opening it in vlc and go to view > stream and media info

oldsko0l 05-25-2006 08:30 AM

oke I'll try the script now thank you, I'll let you know how it went

oldsko0l 05-25-2006 03:33 PM

oke tnx it works great! ;) about 25 minutes on a amd 2200+
btw. did you try to burn it yet? because when I merge subs and avi file on my windows pc and I try to play the cd on my dvd-player (tv) the sync does not fits anymore.. I'll try it the linux-way :D

norah_cobain 05-25-2006 04:22 PM

no didnt burn but it works fine and in sync on my on-harddisk-copy so the file is bound to be identical on a dvd or cd?

oldsko0l 05-25-2006 05:07 PM

why should you want to merg the avi with the sub if you don't want to burn it? (confused)
Quote:

so the file is bound to be identical on a dvd or cd?
I don't understand what your saying with bound.. (my bad english :D)

btw. the sync on my harddisk is also fine with my windows pc method, only when I burned it the sync wasnt anymore :D but I'll figure that out I guess

norah_cobain 05-25-2006 05:24 PM

i want to burn it, and send it to my parents, i just havent gotten around to it yet, gonna sub a lot more files first

with bound i mean that if your burn as data disc (and not video disk) - which is what im planning to do the file on the dvd will have to be identical to the file on the harddisk and therefore not out of sync.

it sounds rather impossible that the subs would be out of sync on dvd/cd if they werent out of sync on harddisk, the subs are a part of the movie and not separate in any way. if the subs are out of sync then the rest of the picture on your screen will have to be out of sync too, you cant desync half the picture can you? and u cant desync the whole picture either cos, hum, then theres nothing left for it to not be in sync with, apart from the audio. did u mean that the audio is out of sync?

sorry if this sounds confusing, i couldnt find a better way of saying it, english isnt my first language either

oldsko0l 05-25-2006 05:42 PM

no I think the problem was something with the burning..
because when I burned the movie without subs the sound was later that the screen
so when they were talking the sound came 2 seconds later.. so it wasen't a problem of the movie self I guess ;)


All times are GMT -5. The time now is 11:12 AM.