Thank you so much for your help.
I chose what Greg Wooledge suggested.
(inotify-tools package is currently not available on my machine.)
This is how the function looks like:
I somewhat touched it, so let me know if I seriously messed it up.
(The numbers are lowered for testing purposes
and the echo will be removed too)
waitfor() {
oldsize=0
while sleep 3; do
size=$(wc -c < "$1")
if ((size > oldsize)); then
oldsize=$size
SECONDS=0
echo 'new loop'
continue
fi
if ((SECONDS > 10)); then
break
fi
done
}
It worked as expected. As soon as the video was processed, there was no
more 'new loop' lines and I got my prompt back in 10s.
(Shutdown line was removed from the function. I prefer to add it
manually in case I want to do different task, like hibernating)