How to convert all linked videos to embedded videos?

I use linked videos while making a presentation to avoid the overhead of embedding. However, when the presentation is finished, I typically want to be able to export a copy of the presentation with all videos embedded.

There are two compelling reasons for this: backups and longevity. If something goes wrong at presentation time, there is a backup that can easily be played on someone else’s machine, and many years later the presentation will still work even though videos files are not necessarily in the same relative location.

So, is there a way to do this? I’m using Impress 3.5.7.2 on Ubuntu 12.04, but newer versions are fine too.

Oh - hacking the zip archive / XML is fine if necessary.

You are going to have to manually change the XML and copy the required video files to a newly created Media/ directory in the ODP. This is what the XML for a linked video[1] looks like:

<draw:plugin xlink:href="../../path/to/video.ogg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="application/vnd.sun.star.media">

… and here is the same video embedded in the ODP:

<draw:plugin xlink:href="Media/video.ogg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="application/vnd.sun.star.media">

[1] Video format is an OGG container with these stream encodings:

Duration: 00:00:31.12, start: 0.000000, bitrate: 578 kb/s
    Stream #0.0: Video: theora, yuv420p, 384x288 [PAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: vorbis, 32000 Hz, stereo, s16, 64 kb/s

oweng, thanks for your reply. This actually looks fairly easy to script, assuming the ogg format isn’t required. I’ll probably give this a try in the near future.

… and the near future is here, sooner than expected. Here’s a gross, poorly-tested script that got the job done for me: portify.

YMMV

@teichman, well done, very similar to how I would solve the problem. Sorry for the confusion about the OGG container (any video merely needs to be in a format with a supported and accessible codec). The footnote was merely illustrative. Other containers / formats are encoded in the same manner (with a corresponding MIME / media type).