scripts/scripts/find_stereo.sh

18 lines
405 B
Bash
Raw Normal View History

2019-06-08 08:59:13 -07:00
#!/usr/bin/env bash
filter='pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak'
for f in $@
do
out=$(ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -)
if [[ "$out" != 'CRC=0x00000001' ]]
then
other="${f%.ogg}.1.ogg"
echo "$f is stereo, converting"
ffmpeg -i "$f" -ac 1 "$other" && mv "$other" "$f"
fi
done
## EOF