find video -name "*.txt" | xargs dirname | sort -u | xargs -I {} find \{} -name "*.MP4" | while read movie; do ffmpeg -i "$movie" -vcodec prores -profile:v 3 -acodec copy "${movie%.*}Final.mov"; done
usage: dirname path
find path/to/total/folder -name "*.txt" -exec dirname {} \;