Difference between revisions of "VLC HowTo/Merge videos together"

From VideoLAN Wiki
Jump to navigation Jump to search
(Misc.)
(--sout-all is default since 2.2.0)
 
Line 4: Line 4:
 
If you have more than one source files that need to be merged into a single output file, the general way is this (no transcoding is necessary if all streams match):
 
If you have more than one source files that need to be merged into a single output file, the general way is this (no transcoding is necessary if all streams match):
  
  {{Prompt|cmd}} '''{{Path to VLC|windows}} file1.ps file2.ps file3.ps --sout "#[[Documentation:Modules/gather|gather]]:std{access=file,mux=ts,dst=all.ts}" --sout-keep'''
+
  {{Prompt|cmd}} '''{{Path to VLC|windows}} file1.ps file2.ps file3.ps --sout "#[[Documentation:Modules/gather|gather]]:std{access=file,mux=ts,dst=all.ts}" --no-sout-all --sout-keep'''
  
 
NB that whenever you use sout, your video and audio codecs must "be appropriate" for the mux you use (in this case, ps works with a ts mux, so we're ok). See [[Transcode#Transcoding_with_the_Wizard]]
 
NB that whenever you use sout, your video and audio codecs must "be appropriate" for the mux you use (in this case, ps works with a ts mux, so we're ok). See [[Transcode#Transcoding_with_the_Wizard]]
Line 10: Line 10:
 
If you want to write your files out to a mux that doesn't support the current audio or video encoding, or if you are wanting to join streams that do not have matching video/audio, then it is recommended to transcode as well.  Here is an example.
 
If you want to write your files out to a mux that doesn't support the current audio or video encoding, or if you are wanting to join streams that do not have matching video/audio, then it is recommended to transcode as well.  Here is an example.
  
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.EXT FILE2.EXT FILE3.EXT ETC.ETC --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'''
+
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.EXT FILE2.EXT FILE3.EXT ETC.ETC --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}'''
  
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 ETC.ETC --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=out.mp3} --sout-all'''
+
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 ETC.ETC --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=out.mp3}'''
  
 
Next edit the path to vlc, input files, and transcode parameters to meet your needs.
 
Next edit the path to vlc, input files, and transcode parameters to meet your needs.
  
 
For Example in Windows (all input files are in the same directory from where the command is executed):
 
For Example in Windows (all input files are in the same directory from where the command is executed):
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=combinedout.mp3} --sout-all'''
+
  {{Prompt|cmd}} '''{{Path to VLC|windows}} -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=combinedout.mp3}'''
  
 
Or you can use file appending:
 
Or you can use file appending:
  
  {{Prompt|cmd}} '''{{Path to VLC|windows}} go.ps.1 go.ps.2 go.ps.3  vlc://quit --sout-file-append --sout=file/ps:go.ps'''
+
  {{Prompt|cmd}} '''{{Path to VLC|windows}} go.ps.1 go.ps.2 go.ps.3  vlc://quit --no-sout-all --sout-file-append --sout=file/ps:go.ps'''
  
 
==Non Interactive Mode==
 
==Non Interactive Mode==

Latest revision as of 08:42, 4 April 2019

This page describes how to merge and transcode multiple videos with a script. Other "how to" pages

Merge & Transcode

If you have more than one source files that need to be merged into a single output file, the general way is this (no transcoding is necessary if all streams match):

> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" file1.ps file2.ps file3.ps --sout "#gather:std{access=file,mux=ts,dst=all.ts}" --no-sout-all --sout-keep

NB that whenever you use sout, your video and audio codecs must "be appropriate" for the mux you use (in this case, ps works with a ts mux, so we're ok). See Transcode#Transcoding_with_the_Wizard

If you want to write your files out to a mux that doesn't support the current audio or video encoding, or if you are wanting to join streams that do not have matching video/audio, then it is recommended to transcode as well. Here is an example.

> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" -vv FILE1.EXT FILE2.EXT FILE3.EXT ETC.ETC --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}
> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 ETC.ETC --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=out.mp3}

Next edit the path to vlc, input files, and transcode parameters to meet your needs.

For Example in Windows (all input files are in the same directory from where the command is executed):

> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" -vv FILE1.mp3 FILE2.mp3 FILE3.mp3 --sout-keep --sout=#gather:transcode{acodec=mp3,ab=128}:standard{access=file,mux=dummy,dst=combinedout.mp3}

Or you can use file appending:

> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" go.ps.1 go.ps.2 go.ps.3  vlc://quit --no-sout-all --sout-file-append --sout=file/ps:go.ps

Non Interactive Mode

To do any of this in "non interactive" mode, add -I dummy and also "vlc://quit" to the end of your list of inputs. See Transcode for more detail.

Other options

Overall, none of the ways VLC offers to combine streams appears to merge them with correct time signatures<ref> even when replayed in VLC (causing seeking errors), so a non VLC option might work better. Please update if you find one. Straight concatenation works at times. See also https://spreadsheets.google.com/ccc?key=0AjWmZ0umsuZHdHNzZVhuMTkxTHdYbUdCQzF3cE51Snc&hl=en for a list of several various 3rd party "video joining" utilities.