RSS



How to join multiple .avi or .mpg files

Mon, Aug 7, 2006

ArsGeek, Just Plain Geek, Linux, Ubuntu

Talk about it in our Forums

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.

Technorati Tags: , , , , ,

Popularity: 17% [?]

Share and Enjoy:
  • Digg
  • del.icio.us
  • MisterWong
  • Reddit
  • Technorati
  • BlinkList
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1989 posts on ArsGeek.


Contact the author

52 Comments For This Post

  1. Mr. Pr0n Says:

    This will also work:

    mencoder -oac copy -ovc copy file1 file2 file3 … -o final_movie.mpg

    and please stop talking about ubuntu like it was a godsend, everyone knows that archlinux is much much better :P

  2. arsgeek Says:

    Hey, thanks for the mencoder tip. And what is this Archlinux that you speak of? Damn. Now I’ve got another distro I’ve got to go install and check out. :)

  3. Phil Says:

    avimerge from the transcode package was designed for this task. and as far as i know, it was created before ubuntu. ;P

    avimerge -i b1.avi b2.avi b3.avi b4.avi b5.avi b6.avi b7.avi -o bloodspell.avi

    http://www.transcoding.org/cgi-bin/transcode

  4. arsgeek Says:

    Excellent suggestion Phil. Thanks!

  5. guille Says:

    How can i fix this¿?

    root@guille-desktop:/home/guille# apt-get install mplayer mencoder
    Reading package lists… Done
    Building dependency tree… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    mencoder: Depends: libasound2 (> 1.0.14) but 1.0.10-2ubuntu4 is to be installed
    Depends: libc6 (>= 2.6-1) but 2.3.6-0ubuntu20.5 is to be installed
    Depends: libdvdread3 (>= 0.9.6) but 0.9.4-5.1 is to be installed
    Depends: libfontconfig1 (>= 2.4.0) but 2.3.2-1.1ubuntu12 is to be installed
    Depends: libfreetype6 (>= 2.3.5) but 2.1.10-1ubuntu2.4 is to be installed
    Depends: libgcc1 (>= 1:4.2.1) but 1:4.0.3-1ubuntu5 is to be installed
    Depends: liblame0 (>= 3.97) but 3.96.1-1 is to be installed
    Depends: libncurses5 (>= 5.6) but 5.5-1ubuntu3 is to be installed
    Depends: libpng12-0 (>= 1.2.13-4) but 1.2.8rel-5ubuntu0.3 is to be installed
    Depends: libstdc++6 (>= 4.2.1) but 4.0.3-1ubuntu5 is to be installed
    Depends: libx264-54 but it is not installable
    Depends: zlib1g (>= 1:1.2.3.3.dfsg-1) but 1:1.2.3-6ubuntu4 is to be installed
    mplayer: Depends: libasound2 (> 1.0.14) but 1.0.10-2ubuntu4 is to be installed
    Depends: libatk1.0-0 (>= 1.13.2) but 1.11.4-0ubuntu1 is to be installed
    Depends: libc6 (>= 2.6-1) but 2.3.6-0ubuntu20.5 is to be installed
    Depends: libcaca0 (>= 0.99.beta11-1) but it is not installable
    Depends: libcairo2 (>= 1.4.0) but 1.0.4-0ubuntu1.2 is to be installed
    Depends: libcucul0 (>= 0.99.beta11-1) but it is not installable
    Depends: libdbus-1-3 (>= 1.1.1) but it is not installable
    Depends: libdbus-glib-1-2 (>= 0.74) but 0.60-6ubuntu8.1 is to be installed
    Depends: libdvdread3 (>= 0.9.6) but 0.9.4-5.1 is to be installed
    Depends: libfontconfig1 (>= 2.4.0) but 2.3.2-1.1ubuntu12 is to be installed
    Depends: libfreetype6 (>= 2.3.5) but 2.1.10-1ubuntu2.4 is to be installed
    Depends: libgcc1 (>= 1:4.2.1) but 1:4.0.3-1ubuntu5 is to be installed
    Depends: libggi2 (>= 1:2.2.1) but it is not going to be installed
    Depends: libglib2.0-0 (>= 2.14.0) but 2.10.3-0ubuntu1 is to be installed
    Depends: libgtk2.0-0 (>= 2.12.0) but 2.8.20-0ubuntu1.1 is to be installed
    Depends: liblame0 (>= 3.97) but 3.96.1-1 is to be installed
    Depends: libncurses5 (>= 5.6) but 5.5-1ubuntu3 is to be installed
    Depends: libpango1.0-0 (>= 1.18.2) but 1.12.3-0ubuntu3 is to be installed
    Depends: libpng12-0 (>= 1.2.13-4) but 1.2.8rel-5ubuntu0.3 is to be installed
    Depends: libpulse0 but it is not installable
    Depends: libsdl1.2debian (>= 1.2.10-1) but 1.2.9-0.0ubuntu2 is to be installed
    Depends: libstdc++6 (>= 4.2.1) but 4.0.3-1ubuntu5 is to be installed
    Depends: libx264-54 but it is not installable
    Depends: libxcomposite1 (>= 1:0.3-1) but it is not going to be installed
    Depends: libxdamage1 (>= 1:1.1) but 1:1.0.2.2-0ubuntu2 is to be installed
    Depends: libxfixes3 (>= 1:4.0.1) but 1:3.0.1.2-0ubuntu3 is to be installed
    Depends: libxrandr2 (>= 2:1.2.0) but 1:1.1.0.2-0ubuntu4 is to be installed
    Depends: zlib1g (>= 1:1.2.3.3.dfsg-1) but 1:1.2.3-6ubuntu4 is to be installed
    E: Broken packages
    root@guille-desktop:/home/guille#

  6. arsgeek Says:

    guille, what version of Ubuntu are you running this on? Are you using non-stable repositories?

  7. faxm0dem Says:

    Listen to what Mr. Pr0n said. Forget that UUOC and use mencoder directly

  8. Joe Francais Says:

    Try using Jfuse (http://www.jfuse.com). It joins all types of media files.

  9. lalo Says:

    using ubuntu 8.04, with mencoder installer. I joined the mpeg files using cat then encoded both ways first tried arsgeek instructions and joined 1 file, then used Mr Pr0n instructions and made a second file. The issue is that I have sound but no video ? any ideas….. thanks for the help

  10. villate Says:

    lalo: totem movie player does not show the video, but it is there. Try opening the file with mplayer or avidemux. However, there seems to be something wrong with the file created that way: both mplayer and avidemux refuse to fast forward it; I don’t know what causes that problem.

  11. villate Says:

    OK, I figured it out. If you want to merge mpg files you must use this:

    mencoder -oac copy -ovc copy -of mpeg part1.mpg part2.mpg -o all.mpg

  12. nic Says:

    come on… buy a real computer and use iMovie/Quicktime/After Effects/Nuke/…

  13. dnfm Says:

    Yea, what nic said! Blow all sorts of money on inferior crap that’s locked down hard and is prone to breaking just so you can be a fanboy too!

  14. Zee Caniago Says:

    Thanks for the tutorial. it works great ! :)

  15. Azazello Says:

    works great, thanks.

  16. ASG Says:

    Typo:
    mencoder -forceidx -oac copy -ovc copy bloodspell.avi.avi -o bloodspell_final.avi

    Should be:

    mencoder -forceidx -oac copy -ovc copy bloodspell.avi -o bloodspell_final.avi

  17. precy romero Says:

    Thank you for walking me through the step by step process. I must admit I’m a total newbie to this. Nice job ASG for sorting out the correct and exact site. I could easily get lost.

  18. Jack Hackett Says:

    Ran memcoder, I got great Picture, BUT NO SOUND.
    Please HELP!

    jack@ubuntu:~/Temp$ mencoder -forceidx -oac copy -ovc copy YJ.avi -o YJ-B.avi
    MEncoder SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
    success: format: 0 data: 0×0 – 0x4da2d4a0
    AVI file format detected.
    [aviheader] Video stream found, -vid 0
    [aviheader] Audio stream found, -aid 1
    AVI: Generated index table for 649309 chunks!
    VIDEO: [DIVX] 720×480 24bpp 29.970 fps 886.6 kbps (108.2 kbyte/s)
    [V] filefmt:3 fourcc:0×58564944 size:720×480 fps:29.970 ftime:=0.0334
    videocodec: framecopy (720×480 24bpp fourcc=58564944)
    audiocodec: framecopy (format=55 chans=2 rate=48000 bits=0 B/s=16000 sample-0)
    Writing header…
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Writing header…
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Pos:2188.4s 65585f (25%) 5536.94fps Trem: 0min 1193mb A-V:0.033 [1021:128]
    Badly interleaved AVI file detected – switching to -ni mode…
    ODML: Starting new RIFF chunk at 1023MB.m: 0min 1264mb A-V:0.033 [908:128]]
    Writing index…063f (99%) 4930.75fps Trem: 0min 1242mb A-V:0.033 [886:128]
    Writing header…
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

    Video stream: 886.561 kbit/s (110820 B/s) size: 1157612993 bytes 10445.869 secs 313063 frames

    Audio stream: 128.000 kbit/s (16000 B/s) size: 129118464 bytes 8069.904 secs

  19. Ordenadores Portatiles Baratos Says:

    Muy buen artículo. Este blog es genial, suerte!

  20. Darek Says:

    Main method to join all mpeg files with mpeg extension in one directory:
    mencoder -oac copy -ovc copy *.mpeg -of mpeg -o join.mpg

  21. Amy Says:

    Thanks for the tutorial. it works great !

  22. FM Transmitter Says:

    This tutorial is god send. Thank you so much for this !!

  23. Yavannah Halostar Says:

    @Joe Francais & @nic:
    You made my day… I am really amazed to see that people are capable to repeat adverts like parrots, but are unable, unlike parrots, to do a bit of thinking on their own part in regards to the applicability of their comments. This thread is old, yes, but I felt urged to comment:

    @nic :
    The operating systems the software you suggest require are broken by design and the software you suggest might have a nice gui, but it lacks wider compatibility, basic capabilities, and it is slow and far from efficient. That it all does cost a lot of money doesn’t make these arguments less valid, but instead underscores them in bold.
    Besides, Microsoft only now starts considering porting Windows to some decent CPU platform ( ARM ) after they abandoned more advanced platforms in the past already ( DEC Alpha ), like Apple did a while ago ( switching from powerPC platform to Intel’s x86 platform ) .
    Accordingly, on up-to-date platforms, your software wouldn’t work, whilst mencoder works since years on all platforms, thanks to Linux and it’s ubiquity.

    @Joe Francais :
    Though not as failed as nic, please read what the wrapping on a program says: JFuse is propietary software, and available only for Windows and just since recently for MacOS, too. Accordingly putting money out for a program that is usable mostly as a paperweight is not really smart, and the time and effort invested into getting it to run on any decent OS is way better invested in just typing the mencoder – sequence and have the job done swiftly and reliably.

    It’s not that I am agaisnt commercial Software – I use MainActor Broadcast and EAGLE regularly with pretty expensive licenses attached – it’s just that, really, commercial software should be au-par with freely available one ( like GEDA equals EAGLE easily, but there are more libraries packed with Eagle at this time ) and not blatantly inferior. When such software then is equal, or even better than free equivalents, however, often the software is incompatible to ones OS of choice, which renders the entire package useless from the beginning.

  24. Mahy Says:

    @Mr. Pr0n et al.: I tried mencoder without “cat” and it crashed halfway into the conversion process! However, when I ran cat first and only then mencoder, it suddenly worked. Now talk about UUOC…

  25. coach purses on sale Says:

    before coveted, quickly seize this year the popular trend and beautiful bag, then quickly quasi malicious elements to make moves.

  26. cheap designer handbag Says:

    Hello Site owner. My companion and i really just like the posting and the website online all in all! Your put up could be very plainly written in addition to with out difficulty understandable. The Weblog theme is great as properly! Would positively be nice to know exactly where I can purchase it. If potential keep up the nice job. All of us want much more this type of web site homeowners equivalent to you online and in addition much less spammers. Wonderful mate!

  27. christian louboutin Says:

    How to join multiple .avi or .mpg files | Ars

  28. designer handbags wholesale Says:

    useful posting, thanks

  29. designer handbags outlet Says:

    Welcome to our site, buy the things you like. Please click on my name, this simple action may give you a surprise! Thank you.

  30. tiffany outlet Says:

    Hey, superb post! please keep it up..

  31. Paris Mcnichols Says:

    In my opinion you will find there’s concern aided by the Rss in this case. Feels like some worn out connection to everybody?

  32. mens leather belts Says:

    i like your blog very much.Thanks for sharing information

  33. michael kors outlet Says:

    This is a message to the website owner. Please check out my friends website, he is offering a very good service that you may be intrested in. Does your website not get hardly any visitors or not rank for keywords with Google? Well he can help! He can provide you with tens of thousands of backlinks to your site!

  34. prada handbags replica Says:

    You raise many questions in my head; you wrote a good post, but it is also thought provoking, and I will have to ponder it some more; I will return soon.

  35. coogi clothing Says:

    The theme is really attractive. Congratulations to the author of the blog!

  36. cheap prada handbags Says:

    I am glad to found such useful post. I really increased my knowledge after read your post which will be beneficial for me.

  37. Monster beats studio Says:

    You’re probably sick of hearing it, but you’ve got a really well written blog. Keep up the the great work.

  38. Alvin Raffaele Says:

    This is certainly probably the most extraordinary blog pages Ive browse in a really quite a while. The quantity of information in here’s spectacular, such as you essentially has written the book on the matter. Your blog is ideal for everybody who wants to understand this unique topic more. Excellent information; please keep writing!

  39. fake jewelry Says:

    A British wind of this one season Topshop qiu dong to restore ancient ways more glaring, paint material and sequins by many use, restore ancient ways to rich chain bag and that a super cute zero purse must be must be your qiu dong the necessary money.

  40. computer stores fresno Says:

    Good article , thanks and we want more! Added to FeedBurner as well

  41. computer consulting san francisco Says:

    I really relate to that post. Thanks for the info.

  42. custom decals Says:

    Wow, I enjoyed your neat post.

  43. wholesale bags Says:

    Whats up very cool site!! Guy .. Beautiful .. Superb .. I will bookmark your web site and take the feeds also?I am happy to seek out numerous useful information here within the submit, we need work out more strategies on this regard, thanks for sharing. . . . . .

  44. Tui Mein Schiff Says:

    Thanks I just tried this and it still works. Very helpful.

  45. Polo Outlet Says:

    Of,course! As well know, your article is very attractive, many of my friends have such thoughts, like so many people comment on your articles, look forward to your new works

  46. fake coach purses Says:

    Now the idea change greatly, people choose to watch, as buy clothes, are no longer the intrinsic performance as the only standard to measure quality. In cosmetics, maintain article can “tailor-made” new s, Vestal watch also to his own family, play really I personality.

  47. fake designer bags Says:

    In addition to the eye key to depict, other all do to the shallow. To make the eyes and sparkly, can’t forget to beauty of them, that our Chinese MM has synchronization.

  48. replica belts Says:

    Most of the report of the tide brand BBC “Ice Cream” (BBC Ice Cream) will be in this month’s 19 issue new summer single product. This still including the color with space beach as the design theme of the printing design Tee

  49. coach replica purses Says:

    No matter how much you strong tie-in ace; No matter you are walking in front of the trend more da, all kinds of clothing shop are necessary to you.

  50. fake coach purses Says:

    I really appreciate the blog since the first time do I saw it. Now they have reached another milestone which lead us to report about it,
    and I think it’s a great new… as the content of the text.

  51. cheap dr dre headphones Says:

    I feel that is one of the such a lot significant information for me. And i am satisfied reading your article. But should commentary on some normal things, The site taste is great, the articles is in point of fact great : D. Excellent task, cheers

  52. Brunello cucinelli Says:

    Thanks this, will be useful for our joined Avi files.

10 Trackbacks For This Post

  1. collegiuateubiquity » Blog Archive » how to join multiple .avi or .mpg files - the easy way Says:

    [...] read more | digg story [...]

  2. ArsGeek :: How to edit several AVI (or mpeg) files joined together Says:

    [...] Previously we looked at how to join several AVI files together, and then how to burn them to a DVD. [...]

  3. How to join multiple .avi or .mpg files : Tech Tips Says:

    [...] How to join multiple .avi or .mpg files [...]

  4. How to copy a dual layer DVD in Linux : Tech Tips Says:

    [...] Now that we’ve looked at doing various things to multimedia files and burning them to a DVD, let’s examine how to make a copy of a dual layer DVD. If you have a dual layer burner, then there’s no reason to read further. If you’re like me howevever, and you have a single layer (4.7GB) drive and DVDs then this will be a helpful guide. [...]

  5. ArsGeek - Free your inner geek » Bloodspell concludes with Episode 14 Says:

    [...] I’ve made several posts about Bloodspell and working with it’s various episodes. [...]

  6. links for 2007-02-04 at molgar.net Says:

    [...] ArsGeek – Free your inner geek » How to join multiple .avi or .mpg files Cómo unir archivos avi o mpg usando la consola de linux. (tags: video linux ubuntu avi howto mencoder mpeg join) UncategorizedShare This [...]

  7. Pareto :: Rotar video :: April :: 2007 Says:

    [...] ser que necesitemos instalar algunos paquetes, y luego sincronizar el sonido (yo no lo necesité), acá esta el resto. Comments [...]

  8. Just Another Blog » Blog Archive » Samle / joine video filer Says:

    [...] http://www.arsgeek.com/2006/08/07/how-to-join-multiple-avi-or-mpg-files/ [...]

  9. links for 2009-09-28 Says:

    [...] How to join multiple .avi or .mpg files | ArsGeek (tags: linux howto video) [...]

  10. How to join multiple .avi or .mpg files | ArsGeek « Rambles of Ev Says:

    [...] How to join multiple .avi or .mpg files | ArsGeek. Click here to cancel [...]

Leave a Reply