Unbuffered parsing of mplayer output in shell script

248 views Asked by At

After trying several variants with stdbuf and unbuffer for parsing mplayer (and in my case also libdvdnav) output in a shell script, I didn't found a working solution. Here is my shell script without the part that parses the output - it just runs echo over each line.

#!/bin/bash
IN=video.iso
OUT=video.mpg

IFS=$'\n'
for line in `stdbuf -oL -eL mplayer -msglevel identify=6 -dumpstream -dumpfile $OUT dvdnav://1/$IN 2>&1`; do
    echo "mplayer: $line"
done

The output is buffered even when using stdbuf, so I'm not able to parse each line in real time. Is there a way to catch mplayer output when using the dvdnav target?

0

There are 0 answers