Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Tip: Join two avi file with mencoder

  1. #1
    Join Date
    Jul 2006
    Location
    Portland, OR
    Beans
    318
    Distro
    Ubuntu 16.04 Xenial Xerus

    Tip: Join two avi file with mencoder

    Joining two or more avi files is easy with mencoder.

    Here is a simple script that I use to do it:

    Code:
    # MjAVI - 2007
    #Mencoder needs to be installed for this script to work
    #The Numbers in this script could be changed to combine more than two files.
    # Mencoder also supports mpeg files. So the .avi could also be changed to .mpg
    
    
    echo "Script to combine two avi files, while syncing audio."
    echo "usage: ./mjavi a1.avi a2.avi combined_temp.avi final.avi" 
    
    cat "$1" "$2" > "$3";
    mencoder -forceidx -oac copy -ovc copy "$3" -o "$4"
    the cat command combines 1 and 2 into 3, but the audio isn't in sync. So, 3 is indexed with mencoder into 4 which has nicely synced audio.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2006
    Location
    Ann Arbor, MI
    Beans
    249
    Distro
    Ubuntu 6.10 Edgy

    Re: Tip: Join two avi file with mencoder

    There's no reason to cat the two files together before encoding because mencoder can handle that as well.
    Code:
    mencoder -forceidx -ovc copy -oac copy -o file.avi p1.avi p2.avi ...

  3. #3
    Join Date
    Aug 2005
    Location
    Fortaleza
    Beans
    73
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Tip: Join two avi file with mencoder

    Quote Originally Posted by neilp85 View Post
    There's no reason to cat the two files together before encoding because mencoder can handle that as well.
    Code:
    mencoder -forceidx -ovc copy -oac copy -o file.avi p1.avi p2.avi ...
    When I try to join 2 mpeg files, how can I make the oputput a mpg file?
    If I try -of mpeg I get a lot of errores like this one:
    ERROR: scr 6715.707, dts 0.000, pts 6714.866

    ERROR: scr 6715.752, dts 0.000, pts 6714.962

    ERROR: scr 6715.794, dts 0.000, pts 6715.058

    ERROR: scr 6715.837, dts 0.000, pts 6715.122

    ERROR: scr 6715.885, dts 0.000, pts 6715.218

    ERROR: scr 6715.925, dts 6715.283, pts 6715.408

    ERROR: scr 6715.927, dts 0.000, pts 6715.282

    ERROR: scr 6715.979, dts 0.000, pts 6715.378

    ERROR: scr 6716.025, dts 0.000, pts 6715.474

    ERROR: scr 6716.066, dts 0.000, pts 6715.538

    ERROR: scr 6716.090, dts 6715.575, pts 6715.700
    Pos:6716.1s 161028f (88%) 473.28fps Trem: 0min 2904mb A-V:0.066 [2976:192]
    ERROR: scr 6716.162, dts 0.000, pts 6715.634

    ERROR: scr 6716.210, dts 0.000, pts 6715.730

    ERROR: scr 6716.254, dts 0.000, pts 6715.794

    ERROR: scr 6716.302, dts 0.000, pts 6715.890

    ERROR: scr 6716.358, dts 0.000, pts 6715.954

    ERROR: scr 6716.369, dts 6716.034, pts 6716.159

    ERROR: scr 6716.371, dts 0.000, pts 6716.050

    ERROR: scr 6716.406, dts 0.000, pts 6716.146

    ERROR: scr 6716.441, dts 0.000, pts 6716.210

    ERROR: scr 6716.485, dts 0.000, pts 6716.306

    ERROR: scr 6716.511, dts 6716.326, pts 6716.451
    Pos:6716.9s 161046f (88%) 473.30fps Trem: 0min 2904mb A-V:0.055 [2976:192]

  4. #4
    Join Date
    Nov 2006
    Beans
    86
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Tip: Join two avi file with mencoder

    Cheers neilp85. Worked PERFECTLY.

  5. #5
    Join Date
    Jun 2006
    Location
    Buenos Aires, Argentina
    Beans
    686
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: Tip: Join two avi file with mencoder

    Thanks for the tip

  6. #6
    Join Date
    Apr 2006
    Location
    Anchorage, AK
    Beans
    125
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Tip: Join two avi file with mencoder

    Quote Originally Posted by LucasLinard View Post
    When I try to join 2 mpeg files, how can I make the oputput a mpg file?
    If I try -of mpeg I get a lot of errores like this one:
    ERROR: scr 6715.707, dts 0.000, pts 6714.866

    ERROR: scr 6715.752, dts 0.000, pts 6714.962

    ERROR: scr 6715.794, dts 0.000, pts 6715.058

    ERROR: scr 6715.837, dts 0.000, pts 6715.122

    ERROR: scr 6715.885, dts 0.000, pts 6715.218

    ERROR: scr 6715.925, dts 6715.283, pts 6715.408

    ERROR: scr 6715.927, dts 0.000, pts 6715.282

    ERROR: scr 6715.979, dts 0.000, pts 6715.378

    ERROR: scr 6716.025, dts 0.000, pts 6715.474

    ERROR: scr 6716.066, dts 0.000, pts 6715.538

    ERROR: scr 6716.090, dts 6715.575, pts 6715.700
    Pos:6716.1s 161028f (88%) 473.28fps Trem: 0min 2904mb A-V:0.066 [2976:192]
    ERROR: scr 6716.162, dts 0.000, pts 6715.634

    ERROR: scr 6716.210, dts 0.000, pts 6715.730

    ERROR: scr 6716.254, dts 0.000, pts 6715.794

    ERROR: scr 6716.302, dts 0.000, pts 6715.890

    ERROR: scr 6716.358, dts 0.000, pts 6715.954

    ERROR: scr 6716.369, dts 6716.034, pts 6716.159

    ERROR: scr 6716.371, dts 0.000, pts 6716.050

    ERROR: scr 6716.406, dts 0.000, pts 6716.146

    ERROR: scr 6716.441, dts 0.000, pts 6716.210

    ERROR: scr 6716.485, dts 0.000, pts 6716.306

    ERROR: scr 6716.511, dts 6716.326, pts 6716.451
    Pos:6716.9s 161046f (88%) 473.30fps Trem: 0min 2904mb A-V:0.055 [2976:192]
    http://www.mplayerhq.hu/DOCS/HTML/en...feat-mpeg.html

    Also if you have two mpg's of the same format, couldn't you just "cat 1 2 > 3"?
    Last edited by z987k; March 15th, 2007 at 05:09 PM.

  7. #7
    Join Date
    Jul 2006
    Location
    Portland, OR
    Beans
    318
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Tip: Join two avi file with mencoder

    if you just use cat, its my understanding that the index would not be preserved. this process creates a working index.

  8. #8
    Join Date
    Jul 2005
    Location
    2 exits past crazy
    Beans
    4,222
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: Tip: Join two avi file with mencoder

    How about just using avimerge which is included with transcode?

    Edit: Wow! Holy Thread Resurrection Batman!

  9. #9
    Join Date
    Jul 2006
    Location
    Portland, OR
    Beans
    318
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Tip: Join two avi file with mencoder

    I created this thread almost a year ago, a lot has changed since then.

  10. #10
    Join Date
    Jul 2008
    Beans
    32

    Re: Tip: Join two avi file with mencoder

    i just found it, and it works great for me. i guess my only suggestion to ppl reading this would be to type in 'cd ~/Desktop' into terminal (if thats where your files are at), no ' symbols, just the stuff between. type that before you do the mencoder command line

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •