So far I only have spaces and single quotes to deal with, so I put double quotes around it
#!/bin/bash
#ffmpeg -i Muppets\ Most\ Wanted_KBYUT_2017_07_08_18_56_00.wtv -f ffmetadata metadata.txt
#ffmpeg -i Gene\ Roddenberry\'s\ Andromeda_COMET_2017_12_14_20_05_51.wtv -f ffmetadata metadata1.txt
find . -type f | grep 'wtv$' | while read file; do
echo "----"
echo "----"
echo "----"
echo "$file"
ls -alh "$file"
echo "$file.txt"
#ffmpeg -i "$file" -f ffmetadata "$file.txt"
done
prints out
stephen@B450-AORUS-M:~/Videos$ ./ffmetadata.sh
./Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv
-rw------- 1 stephen stephen 7.9G Sep 6 2019 './Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv'
./Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv.txt
./Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv
-rw------- 1 stephen stephen 794M Dec 16 2017 "./Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv"
./Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv.txt
Looks ok, so I try letting ffmpeg do its thing, by uncommenting the one line, and I get
stephen@B450-AORUS-M:~/Videos$ ./ffmetadata.sh
./Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv
-rw------- 1 stephen stephen 7.9G Sep 6 2019 './Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv'
./Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv.txt
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
...
Input #0, wtv, from './Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv':
Metadata:
WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
Title : Muppets Most Wanted
...
Output #0, ffmetadata, to './Muppets Most Wanted_KBYUT_2017_07_08_18_56_00.wtv.txt':
Metadata:
WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
Title : Muppets Most Wanted
...
Stream mapping:
Press [q] to stop, [?] for help
size= 2kB time=-577014:32:22.77 bitrate=N/A speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded
----
----
----
/Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv
ls: cannot access "/Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv": No such file or directory
/Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv.txt
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
...
libpostproc 54. 7.100 / 54. 7.100
/Gene Roddenberry's Andromeda_COMET_2017_12_14_20_05_51.wtv: No such file or directory
The first file works, but the second file looses the leading dot, changing the relative path to an absolute path. I tried 3 file in the folder, and 2 work. 4 files 2 work. 6 files 3 work.