
Até agora, só tenho espaços e aspas simples para lidar, então coloquei aspas duplas
#!/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
imprime
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
Parece ok, então tento deixar o ffmpeg fazer o seu trabalho, descomentando uma linha, e recebo
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
O primeiro arquivo funciona, mas o segundo arquivo perde o ponto inicial, alterando o caminho relativo para um caminho absoluto. Tentei 3 arquivos na pasta e 2 funcionaram. 4 arquivos 2 funcionam. 6 arquivos 3 funcionam.
Responder1
A liderança "." está sendo consumido por ffmpeg
(quando pergunta sobre o mapeamento de fluxo), que compartilha sua entrada padrão com read
.
Você deve usar find
os recursos de:
find . -type f -name '*wtv' -ls -exec ffmpeg -i {} -f ffmetadata {}.txt \;
Ele encontra arquivos cujo nome termina com wtv
, mostra suas informações detalhadas (que é uma extensão GNU; use -print
se find
não suportar ls
) e é executado ffmpeg
neles.