On this page I will try and pull together a number of recipies for encoding video into different formats.
3GP for Mobile Phones
This method requires three steps. Now assume we have a file called movie.mpeg
and we want to convert it to movie.3GP
. The steps required would be
mencoder movie.mpeg -nosound -ovc lavc \
-lavcopts vcodec=mpeg4 \
-vop expand=176:144,scale=176:-2 \
-o movie.avi -ofps 12
This will extract the video, scale it and reduce the frame rate. Now we need to extract the sound.
mplayer -vo null -ao pcm -af \
resample=8000,volume=+4db:sc movie.mpeg
An output file called audiodump.wav
will be created that has the audio that we require. Finally we need to combine these two files together.
ffmpeg -i movie.avi -i audiodump.wav \
-b 48 -ac 1 -ab 12 -map 0.0 -map 1.0 movie.3GP
I have been told that this can be done in one command as follows
ffmpeg -i movie.mpeg -vcodec mpeg4 -r 15 -b 128k -s qcif \
-acodec amr_nb -ar 8000 -ac 1 -ab 13 -f 3gp -y output.3gp
AVI File for inport to Kino
mencoder -oac mp3lame -ovc xvid -of avi -xvidencopts bitrate=1350 \
-o output.avi input.flv
MP4 for iPod Video
For this to work, faac and xvid need to be configured in ffmpeg.
For a 4:3 video, use:
ffmpeg -i foo.avi -f mov -b 1800 -maxrate 2500 \
-vcodec xvid -qmin 3 -qmax 5 -s 320x240 \
-acodec aac -ab 128 \
foo.ipod.mov
For 16:9 video, use:
ffmpeg -i foo.avi -f mov -b 1800 -maxrate 2500 \
-vcodec xvid -qmin 3 -qmax 5 \
-s 320x180 -padtop 30 -padbottom 30 \
-acodec aac -ab 128 \
foo.ipod.mov
Rotate video
This one comes from the Hampshire Linux User Group mailing list. This is used to rotate a video by 90 degrees.
mencoder -oac copy -ovc lavc -lavcopts \
vcodec=mjpeg -vop rotate=1 00250.avi -o 00250_rot.avi
Join some AVI files together
mencoder -forceidx -ovc copy -oac copy -o file.avi p1.avi p2.avi ...
Create a DVD from a bunch of avi’s
movie-to-dvd -r 720x576 -d letterbox -f auto -a 16:9 \
-A 16:9 -q low -Q auto -o DVD -O "-aid 0" -M *.avi
That will create a bunch of VOB’s in a sudirectory called DVD. However, I am currently having a few problems with this on damaged mpeg files where the audio goes out of sync with the video. I am currently playing with ffmpeg to see if I can come up with a set of options to replace this command, and fix the audio. The following has worked best so far.
ffmpeg -i input.mpg -target pal-dvd -b 3000000 -aspect 16:9 \
-vcodec mpeg2video -acodec copy -map 0:0 -map 0:2 -vsync 0 -y output.vob
cd DVD && movie-make-title-simple -o title -m pal -n none
That will do some stuff to create the title
movie-title -o title.vob -t title prog1.vob prog2.vob prog3.vob
Actually create the title VOB and prepare the xml file for dvdauthor.
dvdauthor -o disk1 -x title.vob-dvdauthor.xml
That will bunch the whole lot up ready to burn to a disk.
growisofs -speed 1 -dvd-compat -Z /dev/scd0 -dvd-video disk1/
Burn baby, burn!
This process still needs some tweaking as the menus are not working properly yet. I expected that I would have a still picture for each button, but all I have is blank squares with a play button above.
And some more
The above are recipies that I have actually used, and recorded here for future reference. Here is a link to some more that may be usefull, but I have not actually tried myself.
http://streaming411.com/wiki/index.php?title=Encoding_prerecorded_video
Archiving MythTV Recordings
I have decided to have a go at archiving some of my MythTV recordings. This has proven to be a little more problematical than first expected, as the OOTB solutions just did not quite do the job.
First use the edit function in MythTV and set up the cut points to remove adverts etc., then log into Mysql, and select the mythconverg
database. Then run the following query:
select chanid,starttime,title from recorded;
This will list all the recorded programs, and the other information that is needed for the next step. Now run mythtranscode
as follows:
mythtranscode --chanid 1519 --starttime 2007-11-08-18-55-00 \
--mpeg2 --honorcutlist -o A\ really\ cool\ film.mpg
Note that the start time required by mythtranscode is in a slightly different format to that stored in the Mysql database.
Once I have done this, I then use the recipe mentioned further up the page to record this file as a DVD.
Pingback: Andreas Neumeier » 3gp encoding
Pingback: Stuphi » Blog Archive » nuvexport - export files from Mythtv
Pingback: Com rotar un video? « Seaside Rendezvous
Pingback: Stuphi » Blog Archive » Easy Peasy Dee Vee Dee