Package: bash Version: 5.0-4 Severity: normal Dear Maintainer, today, while I was writing a script for normalize video, I noticed a strange interaction between "while ... done" (bash script) and program "ffmpeg".
Here is a simple example to reproduce the problem. # get a simple video mp4 for testing wget -c http://techslides.com/demos/sample-videos/small.mp4 # copy url in a variable url="http://techslides.com/demos/sample-videos/small.mp4" <http://techslides.com/demos/sample-videos/small.mp4> # create a variable by repeating this line (separating the url with a space) manyurl="$url $url $url $url $url $url $url $url $url $url $url $url $url $url $url $url $url $url $url $url" # convert to a variable containing the same url as lines for test and display it manyurl_lines="$(for x in $manyurl; do echo $x; done)" echo -e "$manyurl_lines" # output (as expected)http://techslides.com/demos/sample-videos/small.mp4 ...http://techslides.com/demos/sample-videos/small.mp4 # if I now normalize the same file several times, this process interferes with the variable "f" in the loop, eating some initial characters randomly while read -r f; do echo $f; ffmpeg -y -i "small.mp4" -af loudnorm=I=-14:TP=-3:LRA=11:print_format=json -f null - "small_normalized.mp4" &>/dev/null; done <<< "$manyurl_lines" # output (why?):http://techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4 /techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4 /techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4techslides.com/demos/sample-videos/small.mp4 # but if I use the "for ... done" construct this does not happen: for f in $manyurl_lines; do echo $f; ffmpeg -y -i "small.mp4" -af loudnorm=I=-14:TP=-3:LRA=11:print_format=json -f null - "small_normalized.mp4" &>/dev/null; done # output (as expected)http://techslides.com/demos/sample-videos/small.mp4 ...http://techslides.com/demos/sample-videos/small.mp4 # or if comment ffmpeg in the "while ... done": while read -r f; do echo $f; :ffmpeg -y -i "small.mp4" -af loudnorm=I=-14:TP=-3:LRA=11:print_format=json -f null - "small_normalized.mp4" &>/dev/null; done <<< "$manyurl_lines" # output (as expected)http://techslides.com/demos/sample-videos/small.mp4 ...http://techslides.com/demos/sample-videos/small.mp4 there is an explanation for this? -- System Information: Debian Release: bullseye/sid APT prefers unstable APT policy: (700, 'unstable'), (500, 'stable'), (100, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.2.6-custom (SMP w/4 CPU cores; PREEMPT) Locale: LANG=it_IT, LC_CTYPE=it_IT (charmap=ISO-8859-1) (ignored: LC_ALL set to it_IT), LANGUAGE=it (charmap=ISO-8859-1) (ignored: LC_ALL set to it_IT) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages bash depends on: ii base-files 11 ii debianutils 4.8.6.3 ii libc6 2.28-10 ii libtinfo6 6.1+20190713-2 Versions of packages bash recommends: ii bash-completion 1:2.8-7 Versions of packages bash suggests: pn bash-doc <none> -- no debconf information

