Showing posts with label avi. Show all posts
Showing posts with label avi. Show all posts

Thursday, June 14, 2012

How to join or merge multiple .avi or .mpg files

I have recently started watching the fab serialized movie Bloodspell, which is created entirely in Neverwinter Nights.
Bloodspell is released in a series of 6-7 MB files. So far they’re up to part 7. This certainly makes it easier to download on to my laptop and enjoy 10 minutes of Bloodspell at a time. However, I want to burn this to a DVD and watch all seven at once on my home DVD player. Before I did this I just wanted to string together the 7 .avi files into one larger file. (I can’t stand a mess!) Sounds like a simple request? Guess what, in my distro, Ubuntu, it is!

This will most likely work on just about any linux distro that includes the ability to install mplayer/mencoder.
First, let’s get the right programs.
sudo apt-get install mencoder mplayer
Now that the hard part is out of the way, we’re going to make use of the wonderful cat command. I’d renamed each Bloodspell video as b1.avi – b7.avi. Now to string them all end to end.
cat b1.avi b2.avi b3.avi b4.avi b5.avi b6.avi b7.avi > bloodspell.avi
Now we’re 2/3 of the way there! Stringing together .avi files can cause a breakdown in the sync between video and sound. So, we’ll use mencoder to sort things out.
mencoder -forceidx -oac copy -ovc copy bloodspell.avi.avi -o bloodspell_final.avi
That’s it! You’ve got one contiguous .avi file now containing all seven bloodspell releases to date. This will of course work with other .avi files. It will also work with .mpg or .mpeg files as well.
Later we’ll discuss getting this .avi file on to a DVD so you can watch it anywhere.
geek out.

Monday, November 17, 2008

Linux Create / convert AVI file to DVD format ~ Create video DVDs

Create DVD from command line

Following tools get installed with devede:

  1. mencoder : MPlayer’s Movie Encoder) is a simple movie encoder
  2. ffmpeg : FFmpeg video converter
  3. dvdauthor : assembles multiple mpeg program streams into a suitable DVD filesystem

So if you are a pro command line user, type the following commands to convert file1.avi fille2.avi to DVD format (if you are not comfortable with command line use devede GUI software and just skip following commands) :


$ cat file1.avi file2.avi > ccmovie.avi


Now run movie encoder to create out.avi from ccmovie.avi (option -ovc and -oac sets no encoding, just streamcopy)


$ mencoder -o out.avi -noidx -oac copy -ovc copy ccmovie.avi


Next run FFmpeg video converter to set aspect ratio, ntsc dvd television standard etc:


$ ffmpeg -i out.avi -y -target ntsc-dvd -sameq -aspect 16:9 out.mpg


At a high level, a DVD is a collection of menus and titles. Conceptually, a menu contains buttons which can be assigned actions and provides a list of choices to the end user, while a title contains the main content of the DVD. However, in reality many of the features available in menus (including buttons, pausing, and looping) are also available in titles. Use dvdauthor assembles multiple mpeg program streams into a suitable DVD filesystem. You should see DVD filesytem in dvd directory:


$ dvdauthor --title -o dvd -f out.mpg


Creates the table of contents file instead of a titleset:

$ dvdauthor -o dvd -T


Create dvd.iso:

$ mkisofs -dvd-video -o dvd.iso dvd/


Burn dvd.iso to DVD disk:



$
growisofs -dvd-compat -dvd-video -speed=4 -Z /dev/dvdrw=dvd.iso

Embed subtitles into avi

Embed subtiltes into avi.


$ mencoder -oac lavc -ovc lavc \
-sub "subtitle.srt" \
input.avi \
-o output.avi


Embed subtitle into avi and convert into iPod format.


$ mencoder -ss 00:36:36 -endpos 00:01:35 \
-oac faac -faacopts br=160 \
-ovc lavc -lavcopts vcodec=libx264 -vf scale=400:169 \
-sub "subtitle.srt" \
input.avi \
-o output.avi


Convert avi into iPod format.


$ ffmpeg -i output.avi -acodec libfaac -ac 2 output.mov

Convert avi to 3gp

Install ffmpeg:

$ sudo apt-get install ffmpeg


Connvert from avi to 3gp

$ ffmpeg -i movie.avi -s qcif -vcodec h263 -acodec mp3 -ac 1 -ar 8000 -r 25 -ab 32 -y movie.3gp


Convert from 3GP to AVI:

$ ffmpeg -i movie.3gp -f avi -vcodec xvid -acodec mp3 -ar 22050 movie.avi


Convert from MPG to 3GP:

$ ffmpeg -i movie.mpg -s qcif -vcodec h263 -acodec mp3 -ac 1 -ar 8000 -ab 32 -y movie.3gp

Convert from MPG to 3GP:

$ ffmpeg -i input -acodec amr_nb -ar 8000 -ac 1 -ab 12 -vcodec h263 -s qcif -r 10 -aspect 16:9 out.3gp