opus-tools icon indicating copy to clipboard operation
opus-tools copied to clipboard

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

Open lorenzosu opened this issue 7 years ago • 4 comments

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 :)

lorenzosu avatar Mar 08 '18 18:03 lorenzosu

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.

mark4o avatar Mar 09 '18 07:03 mark4o

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 :)

lorenzosu avatar Mar 09 '18 09:03 lorenzosu

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)

rsmaior avatar May 09 '18 01:05 rsmaior

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.

moisespr123 avatar Sep 16 '18 16:09 moisespr123