Video Merging HowTo

Objective: We want to merge several videos with different format size and bitrate into a FHD WebM video stream.

The following shell commands accomplish that task (by using the tcsh!):

  • We assume that the videos to be merged are in a directory named “videos”.
  • We install the cmd line tool avconv from the libav package:
sudo apt-get install libav-tools
  • First, we need to convert all separate files in the video directory into a consistent concatable video format (that is MPEG1):
foreach file ( videos/* )
   avconv -i $file -s 1920x1080 -an -r 24 -b 20000k $file:r.mpeg
  • Secondly, we combine those converted videos into a single one, by simply concatenating them with the good old “cat” tool (works only for MPEG1 and some other formats like raw video):
cat videos/*.mpeg > video.mpeg
  • Lastly, we convert the concatenated MPEG video into a WebM video. For a full HD resolution a bit rate of 2MBit/s is appropriate for the WebM codec:
avconv -i video.mpeg -b 2000k video.webm