20 lines
487 B
Plaintext
20 lines
487 B
Plaintext
|
#!/usr/bin/env fish
|
||
|
|
||
|
function find-stereo -d 'Finds files that are stereo'
|
||
|
set filter 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak'
|
||
|
|
||
|
for f in $argv
|
||
|
set out (ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -)
|
||
|
|
||
|
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
|
||
|
end
|
||
|
|
||
|
## EOF
|