Friday, October 29, 2004

Mutimedia stuff

To create avi or mpeg files from a DVD or VCD, first get disk info (such as titles, chapters, audio languages and subtitle languages) by using mplayer:
Code:
$ mplayer dvd:// -v (-aop list=volume,extrastereo:volume=120 -vf lavcdeint)
$ mencoder dvd://1 -chapter 20-22 -o tiger.avi -oac copy -ovc copy -alang en -slang zh
$ mencoder vcd://1 -ss 00:02:23 -of mpeg -o output.mpeg -oac mp3lame -ovc copy -endpos 00:00:15
$ mencoder dvd://1 -chapter 20 -o tiger.avi -oac mp3lame -ovc divx4 -aid 130 -sid 1 -endpos 50mb


Type 'mencoder -ovc help' to find out available video codecs.
A two pass procedure:
Code:
$ mencoder dvd://1 -oac copy -aid 128 -o movie.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vpass=1 -vf scale=640:480,crop=640:344:0:66,lavcdeint -vobsubout sub-en.txt -sid 1
$ mencoder dvd://1 -oac mp3lame -o movie.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:vpass=2 -vf scale=640:480,crop=640:344:0:66,lavcdeint


To create a mpg file that plays a photo slideshow,type:
Code:
$ img2mpg -d 4 -w sound.wav -o show.mpg -i /path/to/*.jpg


To merge 2 avi files, type:
Code:
$ avimerge -o big.avi -i small01.avi small02.avi


'Img2mpg' is one of the 'mjpegtools' while 'avimerge' belongs to 'transcode'; to verify, type:
Code:
$ qpkg -fp img2mpg


Note: img2mpg has been removed from mjpegtools > -1.6.1.90, it seems it has been incorporated into digikamplugins.
You must have installed 'gentoolkit' to use the 'qpkg' command.

Extracting audio from VOBs/MPEGs/AVIs

MPlayer can be used easily to extract sound. The -vo null options tells MPlayer not to show the video.
Code:
VOB -> AC3:
$ mplayer -vo null -nogui -alang de -dumpaudio -dumpfile lang-de.ac3 *vob
This will extract the German audio to a file called lang-de.ac3.


Code:
VOB -> WAV:
$ mplayer -vo null -nogui -aid 128 -ao pcm -aofile lang-de.wav *vob
This will extract audio track no. 128, downmix the AC3 sound to PCM and write the results to lang-de.wav.


Code:
MPG -> MP2:
$ mplayer -vo null -nogui -dumpaudio -dumpfile audio.mp2 myvideo.mpg
This will extract the audio to a file called audio.mp2.


Code:
AVI -> WAV:
mplayer -vo null -nogui -ao pcm -aofile audio.wav myvideo.avi
This will extract the audio, convert it to PCM and write the resulting .WAV to audio.wav.


I'm not listing all possible options. Generally use -dumpaudio -dumpfile newaudio.extension if you want to extract the audio without processing and -ao pcm -aofile newaudio.wav if you want the WAV itself. Here's a simple one-liner:
Code:
mplayer -ao pcm -aofile audio.wav video.vob ; normalize audio.wav ; oggenc audio.wav audio.ogg


The following is a simple command to rip vob files from a dvd:
Code:
$ mount /mnt/cdrom && vobcopy /mnt/cdrom -l -n 1 -O . -t "vob"


It will create a vob directory in the current directory. To convert these vob files into mpeg (from filename.vob to final.mpg):
Code:
$ tcextract -i filename.vob -t vob -x mpeg2 > movie.m2v
$ tcextract -i filename.vob -a 0 -x ac3 -t vob > movie.ac3
$ mplex -f 8 -o final.mpg movie.*


Konqueror also works, just mount the DVD and copy the vob files.

A ~/.asoundrc that works:
Code:
pcm.mymixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_size 1024
buffer_size 8192
}
bindings {
0 0
1 1
}
}

pcm.!default {
type plug
slave.pcm "mymixer"
}


pcm.dsp0 {
type plug
slave.pcm "mymixer"
}

ctl.mixer0 {
type hw
card 0
}

0 Comments:

Post a Comment

<< Home