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
mltfile="$1"
mltmodfile="${mltfile%.mlt}-mod.mlt"
rdir="$(dirname "${mltfile}")/resources"
resourcefile="$(dirname "${mltfile}")/resources.txt"
# Gather resources
mapfile -t resources <<<$(xq -x '/mlt/chain/property[@name="resource"]' "$mltfile")
echo "Detected resources : ${resources[@]}"
mkdir -p "${rdir}"
\cp "${mltfile}" "${mltmodfile}"
echo -n '' > "${resourcefile}"
for i in "${resources[@]}"
do
filename="$(echo ${i} | md5sum | 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 absolute path (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 absolute path, 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.mlt
├── I'm Not That Girl-mod.mlt
├── resources
│ ├── 24859e7019b62234d653695850b5d901
│ └── b41ee82cc5848678a5a05cc436c6fb41
└── resources.txt
2 directories, 5 files
And doing a diff between the two project files:
$ diff "I'm Not That Girl.mlt" "I'm Not That Girl-mod.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/24859e7019b62234d653695850b5d901</property>
55c55
< <property name="resource">/home/chiraag/ವಿಡಿಯೊಗಳು/Canon/2026-01-30/MVI_0336.MP4</property>
---
> <property name="resource">resources/b41ee82cc5848678a5a05cc436c6fb41</property>
If we want to know which resource corresponds to which original file, we only have to look at resources.txt:
$ cat resources.txt
/home/chiraag/ದಸ್ತಾವೇಜುಗಳು/Ardour_Projects/I'm Not That Girl/export/I'm Not That Girl_louder-eq.flac -> resources/24859e7019b62234d653695850b5d901
/home/chiraag/ವಿಡಿಯೊಗಳು/Canon/2026-01-30/MVI_0336.MP4 -> resources/b41ee82cc5848678a5a05cc436c6fb41
Hope this is helpful!