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

Thread: Tip: Join two avi file with mencoder

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Location
    Montana, USA
    Beans
    318
    Distro
    Ubuntu Development Release

    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
    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.

  5. #5
    Join Date
    Oct 2007
    Beans
    34
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Tip: Join two avi file with mencoder

    Quote Originally Posted by neilp85 View Post
    Code:
    mencoder -forceidx -ovc copy -oac copy -o file.avi p1.avi p2.avi ...
    Awesome! That worked great!
    CUSTOM BUILT|AMD ATHLON 64 FX-62|DUAL CORE|4GB RAM|3.875 TB HARD DRIVE SPACE
    WINDOWS 7|UBUNTU 9.04 JAUNTY JACKALOPE|SABAYON 4.1

  6. #6
    Join Date
    Apr 2008
    Location
    Missoula, MT USA
    Beans
    137
    Distro
    Kubuntu

    Re: Tip: Join two avi file with mencoder

    Worked great for me too. Thanks for the info!

  7. #7
    Join Date
    Apr 2007
    Location
    UK
    Beans
    189
    Distro
    Ubuntu 11.04 Natty Narwhal

    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 ...
    Thank you so much! Nice bit of code which has been much use to me.
    -KVarley
    -Proud member of the Linux Foundation

  8. #8
    Join Date
    Feb 2009
    Beans
    500

    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 ...
    Just what I was looking for... thank you.

  9. #9
    Join Date
    Mar 2010
    Beans
    24

    Lightbulb To join (concat) AVI-files by mencoder

    Quote Originally Posted by neilp85 View Post
    mencoder can handle that as well.
    Code:
    mencoder -forceidx -ovc copy -oac copy -o file.avi p1.avi p2.avi ...
    Thank you!
    It works! [and much better than by ffmpeg! ]

  10. #10
    Join Date
    Dec 2006
    Beans
    7,304

    Re: To join (concat) AVI-files by mencoder

    Quote Originally Posted by vedavrata View Post
    It works! [and much better than by ffmpeg! ]
    Good to see that you have achieved the desired outcome but have a look at a modern copy of FFmpeg and you might find that there have been some considerable improvements in video concatenation just recently.
    You think that's air you're breathing now?

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
  •