mlt

MLT XML voiceover


I have two video clips and two audio clips. I want to combine them such that each audio overlays on top of its video, and the results run sequentially:

[video0       ][video1  ]
[audio0  ]     [audio1 ]

edit here's a working MLT file. I retain my original, broken XML below for completeness.

<playlist>
  <tractor>
    <multitrack>
      <producer>
        <property name="resource">video0.mp4</property>
      </producer>
      <producer>
        <property name="resource">audio0.wav</property>
      </producer>
    </multitrack>
  </tractor>
  <!-- melt can deduce the multitrack, so this works as well: -->
  <tractor>
    <producer>
      <property name="resource">audio1.wav</property>
    </producer>
    <producer>
      <property name="resource">video1.mp4</property>
    </producer>
  </tractor>
</playlist>

end edit

I tried to do something like this, but I get errors that seem to indicate my structure is wrong, e.g. [producer_xml] End multitrack in the wrong state... and [producer_xml] Invalid state of playlist end 2

<playlist>
  <multitrack>
    <producer>
      <property name="resource">video0.mp4</property>
    </producer>
    <producer>
      <property name="resource">audio0.wav</property>
    </producer>
  </multitrack>
  <multitrack>
    <producer>
      <property name="resource">audio1.wav</property>
    </producer>
    <producer>
      <property name="resource">video1.mp4</property>
    </producer>
  </multitrack>
</playlist>

Solution

  • You are missing tracks. In general:

    1. Declare all the producers first
    2. Then put all the video clips in one playlist and the audio clips in another playlist.
    3. Create two tracks: one for the video playlist and one for the audio playlist
    4. Then, add a "mix" transition between them

    There are really great examples in this documentation: https://github.com/mltframework/mlt/blob/master/docs/mlt-xml.txt

    See the "Tractors" section.