Page 1 of 1

while read used with ffmpeg produces erroneous reading of each line (Solved)

Posted: Thu Oct 19, 2023 8:24 am
by miltonx

There are several files whose paths are included in a file list (/tmp/convertimagelist, content as below)

Code: Select all

/home/spot/Downloads/z's z's a.png
/home/spot/Downloads/z"s z"s x.jpg
/home/spot/Downloads/z's z"s y.png
/home/spot/Downloads/z's z"s z.jpg

Run this:

Code: Select all

while read x;
do
echo "$x"
done </tmp/convertimagelist

results in:

Code: Select all

/home/spot/Downloads/z's z's a.png
/home/spot/Downloads/z"s z"s x.jpg
/home/spot/Downloads/z's z"s y.png
/home/spot/Downloads/z's z"s z.jpg

But, run this:

Code: Select all

while read x;
do
/usr/bin/ffmpeg -y -i "$x" /root/z.jpeg
done </tmp/convertimagelist

results in: (note the missing / at beginning of path)

Code: Select all

home/spot/Downloads/z"s z"s x.jpg: No such file or directory
home/spot/Downloads/z's z"s z.jpg: No such file or directory

Weird thing is, the other two files are successfully treated by ffmpeg.
I fiddled hours and did not find what caused this.


Re: while read used with ffmpeg produces erroneous reading of each line

Posted: Thu Oct 19, 2023 8:38 am
by miltonx

Well, right after posting, I remembered that sometime in the past I hit this:
Should use -nostdin option in ffmpeg
Please refer to this:
https://superuser.com/questions/1088032 ... h-script-i