It is also possible to execute a script to install it before openHAB is started as explained in the documentation.
Adding a /etc/cont-init.d/20-install-ffmpeg
script like this might work:
#!/bin/bash
if ! which ffmpeg >/dev/null; then
echo "Installing ffmpeg"
apt-get update
apt-get install -y ffmpeg
else
echo "ffmpeg is already installed"
fi