Just for fun, I created a handy little script that makes a resources directory and hard links (or copies, depending on whether a hard link is possible) every resource into that folder. It then creates a modified mlt file with the resources entries pointing to the new resources.
#!/bin/bash
shopt -s nullglob
set -o pipefail
set -u
mltpath="$1"
projdir="$(dirname "${mltpath}")"
mltfile="$(basename "${mltpath}")"
projname="${mltfile%.mlt}"
odir="${projname}"
mltmodfile="${odir}/${mltfile}"
rdir="${odir}/resources"
resourcefile="${odir}/resources.txt"
# Gather resources
cd "${projdir}"
mapfile -t resources <<<$(xq -x '/mlt/chain/property[@name="resource"]' "$mltfile")
echo "Detected resources : ${resources[@]}"
mkdir -p "${rdir}" # Will also create ${odir}
\cp "${mltfile}" "${mltmodfile}"
echo -n '' > "${resourcefile}"
for i in "${resources[@]}"
do
filename="$(md5sum < "${i}" | awk '{print $1}')"
echo "${i} -> resources/${filename}" >> "${resourcefile}"
ln -f "${i}" "${rdir}/${filename}"
if [ $? -eq 0 ]
then
echo "Hard link succeeded"
else
echo "Hard link failed, copying ${i}"
cp "${i}" "${rdir}/${filename}"
fi
sed -i "s/${i//\//\\/}/resources\\/${filename}/g" "${mltmodfile}"
done
I did some minimal testing and it seems to do what I want (and shotcut opens the resulting file without issues), but feel free to try this at your own risk (and please report back if you run into issues)! I’m probably not going to use it often, but I do have it saved as shotcut-archive.sh so I can run it as necessary if I want to create a portable version of my project.
One potential issue is if there are multiple resources with the same name but unique paths, since they will be collapsed to the same resource in this scheme. I might switch to hashing the path and using that as the filename… This is resolved in the edited version by using the md5sum of the file (which should be different even if the filenames are the same — otherwise it’s just the same file used multiple times). The resulting filenames are less readable, of course, but it’s probably worth ensuring that filename collisions don’t screw up your project!
As you can see, it uses xq to parse the XML file and extract the appropriate resources. Other than that, it should be relatively portable on Unix-like systems (sorry Windows folks — I’m not very proficient in PowerShell or batch scripts, but feel free to translate this to an equivalent Windows version if you want). It now uses md5sum to calculate the MD5 hash of the file, but that should be relatively widespread and is likely already installed. The newest version should also work even if you don’t run the script from your project directory.
As an example, here’s what my project directory looks like before I run the script:
.
└── I'm Not That Girl.mlt
1 directory, 1 file
I run the script:
$ shotcut-archive.sh I\'m\ Not\ That\ Girl.mlt
Detected resources : /home/chiraag/ದಸ್ತಾವೇಜುಗಳು/Ardour_Projects/I'm Not That Girl/export/I'm Not That Girl_louder-eq.flac /home/chiraag/ವಿಡಿಯೊಗಳು/Canon/2026-01-30/MVI_0336.MP4
Hard link succeeded
Hard link succeeded
And now looking at the project directory again:
.
├── I'm Not That Girl
│ ├── I'm Not That Girl.mlt
│ ├── resources
│ │ ├── e86a8de53f9071e181aaefc1363249b0
│ │ └── fdc72327df7469fdbed86d8c7a4bbf35
│ └── resources.txt
└── I'm Not That Girl.mlt
3 directories, 5 files
And doing a diff between the two project files:
$ diff "I'm Not That Girl.mlt" "I'm Not That Girl/I'm Not That Girl.mlt"
22c22
< <property name="resource">/home/chiraag/ದಸ್ತಾವೇಜುಗಳು/Ardour_Projects/I'm Not That Girl/export/I'm Not That Girl_louder-eq.flac</property>
---
> <property name="resource">resources/e86a8de53f9071e181aaefc1363249b0</property>
55c55
< <property name="resource">/home/chiraag/ವಿಡಿಯೊಗಳು/Canon/2026-01-30/MVI_0336.MP4</property>
---
> <property name="resource">resources/fdc72327df7469fdbed86d8c7a4bbf35</property>
If we want to know which resource corresponds to which original file, we only have to look at resources.txt:
$ cat "I'm Not That Girl/resources.txt"
/home/chiraag/ದಸ್ತಾವೇಜುಗಳು/Ardour_Projects/I'm Not That Girl/export/I'm Not That Girl_louder-eq.flac -> resources/e86a8de53f9071e181aaefc1363249b0
/home/chiraag/ವಿಡಿಯೊಗಳು/Canon/2026-01-30/MVI_0336.MP4 -> resources/fdc72327df7469fdbed86d8c7a4bbf35
Hope this is helpful!