Artificial intelligent assistant

Convert selected audio files in vifm using ffmpeg I'm trying to create a command for converting all audio files selected in vifm using ffmpeg. Here's what I've tried so far: command opus ffmpeg -i %f -q 7 %f:s|flac|opus| This has two problems, however. First, it only works if only one file is selected. If, for example, two are selected, ffmpeg stops with the question, `File 'foo.flac' already exists. Overwrite ? [y/N]`, where `foo.flac` is the second file. Second, it only works if the extension of the original files is `flac`. (I used vifm's substitution macro for replacing `flac` with `opus` in the file name in the example.) I don't know how to include other extensions, too.

After hours of trial and error, I've managed to figure it out.

Write a bash script in a separate file, like `ffmpeg-opus.sh`:


#!/bin/bash

for file; do
ffmpeg -i "$file" -ab 128k "${file%.*}".opus
done


And create a command for it in `vifmrc`:


command opus ffmpeg-opus.sh %f

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b295d30b1a6967228494b818b8a5b2dc