XML authoring/scripting of a simple audiobook with images

I have scanned images from children’s books and I read the corresponding texts aloud into a directory with systematically numbered files:


With such directories I used Shotcut (manually) successfully to assemble four books as *.mp4 files for my grandchildren living on a distant continent. (BTW, I found out that Shotcut under Linux works much more smoothly than under Windows 10.)

So far, so good, but now I got tired of the tedious manual moving, adjusting, aligning the equally numbered clips, specifing the transitions etc. I thought my task were so simple that I wrote a Perl script which reads the directory and completely writes the *.mlt file for Shotcut. My Perl generates producers and playlists properly; it is able to get the files into Shotcut’s main_bin, and to set up a video track V1 and an audio track A1. The script “knows” the durations of the *.ogg files (via sox), and assigns them to the corresponding *.jpg.

But in Shotcut I always get the length of the first video/image file much too long, and though I experimented quite some time with the XML <tractor> elements, I cannot get the project running. Shotcut often freezes also with my generated XML file.

So what I really would like to know is:

  • an up-to-date XML schema (*.xsd) which I could feed into xmllint for example to check the validity of my generated XML (I would even (help to) develop such a schema if I knew what the allowable structures are),
  • a pattern for the necessary and elements,
  • how to specify a transition which emulates a page-turn-over effect.

I read, but did not yet implement the following on https://shotcut.org/notes/mltxml-annotations/:

  • There should be a playlist with the id “background” that contains a black color producer and it should be the first child track element of the last tractor.

Could that be the main cause for the failing of my script?

This is necessary for compositing to work correctly. With Shotcut, make a new project and drag in one video, then delete the video (not the track, just the clip) and save the empty MLT project. Open it in a text editor to see what that hidden black layer should look like in XML.

XML documentation and DTD are available at https://mltframework.org

The XML is ok now. Thank you both. I had read https://mltframework.org/docs/mltxml/ before.
Now with the black background playlist included in the tractor that works much better.

So what would you recommend for a page-turn-over transition? I found
Would that work? And where should I place it? I find no *.pgm below the Shotcut folder on Windows.

Any image or video file could work, not just PGM. They can be stored in your project folder with the other media.

PGM works too, and it can be 16-bit for less banding, but this particular PGM is not and is similar to the stock Diagonal Top Right with the Invert Wipe option turned on. The stock presets are 16-bit and better conform to the aspect ratio.
It is not a page turn, however. Shotcut does not have that. I guess Diagonal Top Left with Invert Wipe is the closest approximation., or perhaps you can find a stock media to use with chroma keys (complicated).

That’s what I was trying to say. Any video or image file could work “in addition to” PGM. Since pre-built PGMs can be difficult to find, my goal was to let the OP know that other formats work too, which could significantly open up the available number of options.

Sorry I misread “not just” as “just not”.

1 Like

I figured, and you’re probably not the only one. I could be more clear with my writing style. More periods, fewer commas, starting after this sentence. :smile:

Thank you for all your advice, and have a Happy New Year.

This topic was automatically closed after 90 days. New replies are no longer allowed.