title: Server side video mixing
body: <p>I have a serie of video files encoded in mpeg2 (I can change this encoding), and I have to produce a movie in flash flv (this is a requirement, I can't change that encoding).</p>
  
  <p>One destination movie is a compilation of different source video files.</p>
  
  <p>I have a playlist defining the destination movie. For example:</p>
  
  <pre><code>Video file        Position        Offset       Length 
  little_gnomes     0               0            8.5
  fairies           5.23            0.12         12.234
  pixies            14              0            9.2
  </code></pre>
  
  <p>Video file is the name of the file, position is when the file should be started (in the master timeline), offset is the offset within the video file, and length is the length of the video to play. The numbers are seconds (in double).</p>
  
  <p>This would result in something like that (final movie timeline):</p>
  
  <pre><code>               0--5.23|--8.5|--14|--17.464|--23.2|
  little_nomes   **************
  fairies               *********************
  pixies                           *****************
  </code></pre>
  
  <p>Where video overlaps, the last video to be added override the last one, the audio should be mixed.</p>
  
  <p>The resulting video track would be:</p>
  
  <pre><code>               0--5.23|--8.5|--14|--17.464|--23.2|
  little_nomes   *******
  fairies               ***********
  pixies                           *****************
  </code></pre>
  
  <p>While the resulting audio would be:</p>
  
  <pre><code>               0--5.23|--8.5|--14|--17.464|--23.2|
  little_nomes   11111112222222
  fairies               222222211112222222222
  pixies                           22222222221111111
  </code></pre>
  
  <p>Where 1 or 2 is the number of mixed audio tracks.</p>
  
  <p>There can be a maximum of 3 audio tracks.</p>
  
  <p>I need to write a program which takes the playlist as input and produce the flv file. I'm open to any solution (must be free/open source).</p>
  
  <p>An existing tool that can do that would be the simplest, but I found none. As for making my own solution, I found only ffmpeg, I was able to do basic things with it, but the documentation is terribly lacking.</p>
  
  <p>It can be any language, it doesn't have to be super fast (if it takes 30 minutes to build a 1h movie it's fine).</p>
  
  <p>The solution will run on opensolaris based x64 servers. If I have to use linux, this would work too. But windows is out of the question.</p>