Joining videos using the command line

13,206

Solution 1

I just needed to do this myself. Your unanswered question helped. Here's what I did:

vlc c:\file1.avi file2.avi 
  --sout "#gather:std{access=file,dst=newFile.avi}" 
  --sout-keep

The example on the VLC wiki page you linked is mux-ing .ps into .ts. I dropped the mux altogether as it wasn't needed in my case. Then pointed it to a destination (dst=) having proper file extension.

Solution 2

You must close VLC before running your newly merged file!

Windows: An alternative method is to use:- copy /B filename1.avi + filename2.avi resultFile.avi

Share:
13,206

Related videos on Youtube

Johan
Author by

Johan

Updated on September 18, 2022

Comments

  • Johan
    Johan over 1 year

    I've had a little mishap with the external harddisk and I've had to restore some files.
    Now I have a bunch of video fragments that I'd like to join up again.

    I can play the fragments using VLC just fine.
    So I went here: https://wiki.videolan.org/How_to_Merge_and_Transcode_Multiple_Videos/
    and followed the instructions.

    The commandline for joining 2 files with the same encoding is:

    vlc c:\file1.avi file2.avi 
      --sout "#gather:std{access=file,mux=ts,dst=all.ts}" 
      --sout-keep
    

    However nothing happens; an empty all.ts file gets created.

     Directory of C:\PROGRA~1\VideoLAN\VLC
    
    all.ts
                   1 File(s)              0 bytes
                   0 Dir(s)  108,900,364,288 bytes free
    

    How do I get vlc to actually create a file with data in it?

    If I use the transcoding option:

    vlc -vvv c:\dir24.avi\fil57.avi c:\dir24.avi\fil58.avi
      --sout-keep 
      --sout=#gather:transcode{vcodec=h264,vb=1024,scale=1,acodec=mp4a,ab=
    192,channels=6}:standard{access=file,mux=ts,dst=out.mpg} 
      --sout-all
    

    I get the following error: enter image description here

    How do I get vlc to join the two files? Note that I do not know the actual encoding of the files.

  • DavidPostill
    DavidPostill over 9 years
    This is not an answer to the original question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
  • Gyan
    Gyan over 8 years
    It is. The OP imitated the VLC doc sample command line, which failed. @kevin-l modified that sample command for AVI files, as described, and it works.
  • JohnnyBob
    JohnnyBob almost 7 years
    Rexa's simple method works with Windows to join two AVI files into one. But the new resulting file only plays the first, not the second. I tried both VLC and WMP. So somehow the AVI envelope must be edited as well, to change the length/time or whatever(?).