scripts/scripts/cmds/find-stereo.fish

18 lines
418 B
Fish
Raw Normal View History

#!/usr/bin/env fish
2019-06-08 08:59:13 -07:00
set filter 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak'
2019-06-08 08:59:13 -07:00
for f in $argv
2019-07-05 19:09:01 -07:00
set out (ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -)
2019-06-08 08:59:13 -07:00
2019-07-05 19:09:01 -07:00
if test "$out" != 'CRC=0x00000001'
set other /tmp/(basename "$f")
echo "$f is stereo, converting"
ffmpeg -i "$f" -ac 1 "$other" && mv "$other" "$f"
else
echo "$f is mono"
end
end
2019-06-08 08:59:13 -07:00
## EOF