Public bug reported: Binary package hint: mplayer
Running mplayer in a loop is impossible because it consumes standard input even when invoked just to batch convert a file. Consider a script like: find . -type f | while read file; do echo "# $file" mplayer -vc null -vo null -ao pcm:file="$file.wav" "$file" done This will fail mysteriously with "No bind found for key 'O'" warnings etc because apparently mplayer is eating some of the output from the find command as if the user were using it interactively and pressing keys to resize the display etc. As an additional symptom, the output from the echo will mysteriously have chopped file names. As a workaround, the small sample script above can be fixed by adding a redirection </dev/null to the mplayer command line. Constructing the loop differently (e.g. to run mplayer from within find with -exec) is another possible workaround. There are several threads about this in Google but none I have found actually correctly diagnosed and corrected this problem. There is a simple ioctl to find out when a program is invoked with standard input connected to a terminal; the "test -t 0" command does this in a shell script. mplayer should leave standard input alone if it is not connected to a terminal. e...@fsopti607:~$ lsb_release -rd Description: Ubuntu 10.04.1 LTS Release: 10.04 e...@fsopti607:~$ apt-cache policy mplayer mplayer: Installed: 2:1.0~rc3+svn20090426-1ubuntu16.1 Candidate: 2:1.0~rc3+svn20090426-1ubuntu16.1 Version table: *** 2:1.0~rc3+svn20090426-1ubuntu16.1 0 500 http://mirrors.nic.funet.fi/ubuntu/ lucid-updates/multiverse Packages 100 /var/lib/dpkg/status 2:1.0~rc3+svn20090426-1ubuntu16 0 500 http://mirrors.nic.funet.fi/ubuntu/ lucid/multiverse Packages ** Affects: mplayer (Ubuntu) Importance: Undecided Status: New ** Description changed: Binary package hint: mplayer Running mplayer in a loop is impossible because it consumes standard input even when invoked just to batch convert a file. Consider a script like: find . -type f | while read file; do - echo "# $file" - mplayer -vc null -vo null -ao pcm:file="$file.wav" "$file" + echo "# $file" + mplayer -vc null -vo null -ao pcm:file="$file.wav" "$file" done This will fail mysteriously with "No bind found for key 'O'" warnings etc because apparently mplayer is eating some of the output from the find command as if the user were using it interactively and pressing keys to resize the display etc. As an additional symptom, the output from the echo will mysteriously have chopped file names. As a workaround, the small sample script above can be fixed by adding a redirection </dev/null to the mplayer command line. Constructing the loop differently (e.g. to run mplayer from within find with -exec) is another possible workaround. There are several threads about this in Google but none I have found actually correctly diagnosed and corrected this problem. There is a simple ioctl to find out when a program is invoked with standard input connected to a terminal; the "test -t 0" command does this in a shell script. mplayer should leave standard input alone if it is not connected to a terminal. + + e...@fsopti607:~$ lsb_release -rd + Description: Ubuntu 10.04.1 LTS + Release: 10.04 + + e...@fsopti607:~$ apt-cache policy mplayer + mplayer: + Installed: 2:1.0~rc3+svn20090426-1ubuntu16.1 + Candidate: 2:1.0~rc3+svn20090426-1ubuntu16.1 + Version table: + *** 2:1.0~rc3+svn20090426-1ubuntu16.1 0 + 500 http://mirrors.nic.funet.fi/ubuntu/ lucid-updates/multiverse Packages + 100 /var/lib/dpkg/status + 2:1.0~rc3+svn20090426-1ubuntu16 0 + 500 http://mirrors.nic.funet.fi/ubuntu/ lucid/multiverse Packages -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/697655 Title: Should not read standard input if not on a terminal -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs