Side by side video with slideshow and change sizes in MLT

80 Views Asked by At

I have a specific task I'm attempting to do. Unfortunately I am not an expert in MLT and was given this project and told to "go do it"

The end goal is to have video plus a slideshow side by side in an mp4 file. This video and the slideshow will change sizes as the presentation goes on.

While I can get the video and the slideshow working side by side, as soon as I attempt to add in transitions to scale the video or slides, everything just absolutely breaks. Here's an example XML file I'm working with (I apologize if it's not properly formed for MLT, this is what I've been given to work with):

<?xml version="1.0" encoding="UTF-8"?>
<mlt>
  <profile width="1920" height="1080" progressive="1" />
  <tractor id="tractor0" global_feed="1" in=":0." out=":3144.">
    <multitrack>
      <playlist id="track0">
        <producer id="background" mlt_service="color" in="0" out=":3144." />
      </playlist>
      <playlist id="vTrack1">
        <blank length=":797." />
        <producer id="video" resource="/root/m/fe96fae3c5974c2fbc9d4b61bce42da129232839.mp4" in=":0." out=":255." />
        <blank length=":1359." />
        <blank length=":258." />
        <blank length=":99." />
        <blank length=":376." />
      </playlist>
      <playlist id="track1">
        <producer id="video" resource="/root/m/08448131a1398de90859264dd8dd46547222c41c.mp4" in=":428." out=":1225." />
        <blank length=":255." />
        <producer id="video" resource="/root/m/08448131a1398de90859264dd8dd46547222c41c.mp4" in=":1480." out=":2839." />
        <producer id="video" resource="/root/m/6b7f6ebb320c0b6c7f3b974c8954d4eb02dd5a2b.mp4" in=":2826." out=":3084." />
        <producer id="video" resource="/root/m/99bf4f550ffb389a4776723e5525868cda3b5953.mp4" in=":0." out=":99." />
        <producer id="video" resource="/root/m/08448131a1398de90859264dd8dd46547222c41c.mp4" in=":3203." out=":3579." />
        <blank length=":0." />
      </playlist>
      <playlist id="slidetrack0">
        <producer id="image" resource="/root/m/content/Slide1.PNG" in=":0." out=":538." />
        <producer id="image" resource="/root/m/content/Slide3.PNG" in=":0." out=":5." />
        <producer id="image" resource="/root/m/content/Slide6.PNG" in=":0." out=":66." />
        <producer id="image" resource="/root/m/content/Slide7.PNG" in=":0." out=":94." />
        <producer id="image" resource="/root/m/content/Slide10.PNG" in=":0." out=":955." />
        <producer id="image" resource="/root/m/content/Slide4.PNG" in=":0." out=":20." />
        <producer id="image" resource="/root/m/content/Slide6.PNG" in=":0." out=":768." />
        <producer id="image" resource="/root/m/content/Slide15.PNG" in=":0." out=":95." />
        <producer id="image" resource="/root/m/content/Slide1.PNG" in=":0." out=":12." />
        <producer id="image" resource="/root/m/content/Slide2.PNG" in=":0." out=":24." />
        <producer id="image" resource="/root/m/content/Slide4.PNG" in=":0." out=":14." />
        <producer id="image" resource="/root/m/content/Slide5.PNG" in=":0." out=":28." />
        <producer id="image" resource="/root/m/content/Slide6.PNG" in=":0." out=":17." />
        <producer id="image" resource="/root/m/content/Slide7.PNG" in=":0." out=":25." />
        <producer id="image" resource="/root/m/content/Slide23.PNG" in=":0." out=":72." />
        <producer id="image" resource="/root/m/content/Slide24.PNG" in=":0." out=":10." />
        <producer id="image" resource="/root/m/content/Slide28.PNG" in=":0." out=":6." />
        <producer id="image" resource="/root/m/content/Slide41.PNG" in=":0." out=":16." />
        <producer id="image" resource="/root/m/content/Slide42.PNG" in=":0." out=":379." />
      </playlist>
    </multitrack>
    <filter gain="1" in=":0." out=":3144." mlt_service="volume" track="2" />
    <transition in=":0." out=":3144" mlt_service="composite" progressive="1" geometry="0/0;1920x1080" halign="left" valign="middle" />
    <transition in=":0." out=":0." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,324:768x432:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":696." out=":696." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,180:1280x720:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1149." out=":1149." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,0:1920x1080:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1619." out=":1619." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,0:1x1:0" halign="left" valign="middle" distort="0" fill="1" />
    <transition in=":1890." out=":1890." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,324:768x432:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1925." out=":1925." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,0:1x1:0" halign="left" valign="middle" distort="0" fill="1" />
    <transition in=":1956." out=":1956." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,0:1920x1080:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1991." out=":1991." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,0:1x1:0" halign="left" valign="middle" distort="0" fill="1" />
    <transition in=":2235." out=":2235." mlt_service="affine" a_track="0" b_track="2" progressive="1" rect="0=0,432:384x216:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":0." out=":0." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=768,216:1152x648:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":696." out=":696." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=1280,360:640x360:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1149." out=":1149." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=0,0:1x1:0" halign="right" valign="middle" distort="0" fill="1" />
    <transition in=":1619." out=":1619." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=0,0:1920x1080:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1890." out=":1890." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=768,216:1152x648:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1925." out=":1925." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=0,0:1920x1080:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":1956." out=":1956." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=0,0:1x1:0" halign="right" valign="middle" distort="0" fill="1" />
    <transition in=":1991." out=":1991." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=0,0:1920x1080:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":2235." out=":2235." mlt_service="affine" a_track="0" b_track="3" progressive="1" rect="0=384,108:1536x864:100" halign="center" valign="middle" distort="0" fill="1" />
    <transition in=":0." out=":3144." mlt_service="mix" a_track="0" b_track="2" combine="1" always_active="1" />
  </tractor>
</mlt>

The end result is that the slides are timed incorrectly somehow and end super early while the transitions seem to be timed correctly. I just don't know where else to look at this point and need guidance. Thank you.

1

There are 1 best solutions below

0
Brian On

One thing I notice right away is that your profile does not specify a frame rate. I expect MLT will choose 25Hz by default on your behalf. But you may not get the timing you expect when specifying frames.

Another thing that might help is that MLT supports time format for in/out properties - which is much easier to read. So, for example, you can specify an out to be 00:01:30.25 if you want the out point to be 1 minute 30.25 seconds.

Finally, I always recommend that people who are trying to learn MLT XML to spend some time with one of the video editors that use it in the backend. KDENLIVE and Shotcut are both popular. Build what you want in the GUI and then inspect the XML that gets saved in the project file.