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

From VideoLAN Wiki
Jump to navigation Jump to search
(note many more ways to concat a file)
(cleanup)
Line 1: Line 1:
==Merge & Transcode in Windows==
+
==Merge & Transcode==
  
If you have more than one source files that need to be merged and transcoded resulting in a single out put file create a batch script with the following line in it:
+
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):
  
<pre>
+
% '''vlc file1.ps file2.ps file3.ps --sout "#gather:std{access=file,mux=ts,dst=all.ts}" --sout-keep'''
"PATH_TO_VLC" -vvv 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
+
 
</pre>
+
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).
 +
 
 +
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.
 +
 
 +
% '''"PATH_TO_VLC" -vvv 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''
  
 
Next edit the path to vlc, input files, and transcode peramiters to meet your needs.
 
Next edit the path to vlc, input files, and transcode peramiters to meet your needs.
  
No transcoding is necessary if all streams match
+
See also [[Documentation:Modules/gather]]
 +
 
 +
Or you can use file appending:
  
  % '''vlc go.ps.1 go.ps.2 go.ps.3 --sout "#gather:std{access=file,mux=ts,dst=out.ts}" --sout-keep'''
+
  % '''vlc go.ps.1 go.ps.2 go.ps.3 vlc://quit --sout-file-append --sout=file/ps:go.ps'''
  
Or you can use file appending
+
==Non Interactive Mode==
  
% '''vlc go.ps.1 go.ps.2 go.ps.3 vlc://quit --sout-file-append --sout=file/ps:go.ps'''
+
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.
  
To do 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 seems to merge them with correct times when replayed in VLC, 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 various "video joining" utilities.
+
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.

Revision as of 12:48, 17 November 2010

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):

% vlc file1.ps file2.ps file3.ps --sout "#gather:std{access=file,mux=ts,dst=all.ts}" --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).

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.

% '"PATH_TO_VLC" -vvv 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

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

See also Documentation:Modules/gather

Or you can use file appending:

% vlc go.ps.1 go.ps.2 go.ps.3  vlc://quit --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.