Reputation: 43
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?
Upvotes: 4
Views: 1150
Reputation: 54212
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
Upvotes: 2