I'm trying to pass codecs to ffmpeg via variables in a bash script, such as
VIDEO='libvpx-vp9'
AUDIO='libopus'
ffmpeg -i name.ext \
-c:v "$VIDEO" \
-c:a "$AUDIO" \
name.webm
But if I try to pass any options for the codecs, such as
AUDIO='libopus -ac 1 -b:a 32k'
It throws this error:
Unknown encoder 'libopus -ac 1 -b:a 32k'
How do I pass codecs + their options to ffmpeg?
As mentioned in the comment above, since the command should be:
ffmpeg -i name.ext -c:v libvpx-vp9 -c:a libopus -ac 1 -b:a 32k name.webm
The double quotes should be removed:
VIDEO='libvpx-vp9'
AUDIO='libopus -ac 1 -b:a 32k'
ffmpeg -i name.ext \
-c:v $VIDEO \
-c:a $AUDIO \
name.webm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With