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

interpretive language scripts


Moderator: Forum moderators

Post Reply
miltonx
Posts: 156
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 11 times
Been thanked: 6 times

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

Post 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.

Last edited by miltonx on Thu Oct 19, 2023 8:39 am, edited 1 time in total.
miltonx
Posts: 156
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 11 times
Been thanked: 6 times

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

Post 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

Post Reply

Return to “Scripts”