xiph / opus-tools

A set of tools to encode, inspect, and decode audio in the Opus format.
https://opus-codec.org/
Other
214 stars 78 forks source link

[FEATURE REQUEST]: opusenc - assume same filename if output file isn't sepcified #27

Open lorenzosu opened 6 years ago

lorenzosu commented 6 years ago

It would be nice to be able to do:

opusenc foo.wav

and get foo.opus as a result like with other encoders

Just a low-priority nice-to-have shortcut :)

mark4o commented 6 years ago

Currently both an input and output file name are required: opusenc input output

If opusenc input is permitted, it would be easy to assume that opusenc input* would also work. However if you have files input1 and input2, you would then end up overwriting input2 since it would assume that was the output file.

A solution would be a command option that treats all files as input files, automatically generating an output file name from each input file name, which could also allow multiple input files to be encoded.

lorenzosu commented 6 years ago

Hi mark, Thanks for your answer, I see now what you mean... I was thinking of behaviour similar to e.g. oggenc where fore example you can do oggenc *.wav and will get corresponding ogg files... But I guess this behaviour could be easily wrapped in a bash script :)

rsmaior commented 6 years ago

While we don't have opusenc *.opus I do

for file in *; do
    opusenc --bitrate 64 "$file" "${file/'.flac'/}".opus
done

(works both in terminal and bash script)

moisespr123 commented 5 years ago

I made a PR that should partially cover this. It assumes the filename, but does not do the recursive encoding. Still, you shouldn't need to write the output filename with PR #38, although it works with both cases.