You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the file extension is fixed when using the Convert plugin in auto mode: the destination path will always end with the extension specified in convert.extension.
Background
My use for the Convert plugin is currently to convert input WAVE files to FLAC at import time. The problem here is that FLAC doesn't support floating-point audio, and thus the conversion to a 32-bit or below fixed-point sample format is necessary for those files. This cannot be simply solved with a single command, as the conversion would apply to all input files, even if they are in a supported sample format already. The solution is to use a shell script as the convert.command which handles all the logic of determining if a resample is necessary:
Unfortunately, a conversion from floating to fixed point is inherently lossy, though I didn't really care about that, as regardless of the method used to convert, the result will never be noticeable. Today I realised that since the reason I collect lossless tracks isn't for the quality, I should stop doing these lossy conversions anyway. I didn't want to store uncompressed WAVE files, as that would take up too much space, so I researched and found that WavPack can losslessly compress 32-bit float audio, though it is less compatible with everything.
I rewrote the shell script to include more cases for sample formats: transcoding to FLAC if it supports it, and WavPack if not:
However, I didn't realise until editing my configuration that the file extension is fixed, and has to be known to Beets before the conversion even begins. You have to specify convert.extension. There is no logic in Beets to determine the file format. And you cannot implement this logic externally.
Ideal behaviour
I would like Beets to not need a specific file extension in the Convert plugin. This could be implemented by checking whether convert.extension is set. If it is, continue with the current behaviour. If it is not:
Set dest to some path prefix: dest = /tmp/beets/convert/tmp-song
Run convert.command. Users will have to manually specify the extension they want in the command: ffmpeg -i $source -c:a flac $dest.flac
When the command is complete, search the temp path for a file with prefix $dest: Find /tmp/beets/convert/tmp-song.flac
Set dest to the file found, and continue with linking, moving, etc.
For those using shell scripts, the extension would be determined and set within the script.
This should maintain compatibility with current behaviour, and will support more powerful transcoding rules.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Issue
Currently, the file extension is fixed when using the Convert plugin in auto mode: the destination path will always end with the extension specified in
convert.extension
.Background
My use for the Convert plugin is currently to convert input WAVE files to FLAC at import time. The problem here is that FLAC doesn't support floating-point audio, and thus the conversion to a 32-bit or below fixed-point sample format is necessary for those files. This cannot be simply solved with a single command, as the conversion would apply to all input files, even if they are in a supported sample format already. The solution is to use a shell script as the
convert.command
which handles all the logic of determining if a resample is necessary:convert-flac-wav.sh
Unfortunately, a conversion from floating to fixed point is inherently lossy, though I didn't really care about that, as regardless of the method used to convert, the result will never be noticeable. Today I realised that since the reason I collect lossless tracks isn't for the quality, I should stop doing these lossy conversions anyway. I didn't want to store uncompressed WAVE files, as that would take up too much space, so I researched and found that WavPack can losslessly compress 32-bit float audio, though it is less compatible with everything.
I rewrote the shell script to include more cases for sample formats: transcoding to FLAC if it supports it, and WavPack if not:
convert-wav.sh
However, I didn't realise until editing my configuration that the file extension is fixed, and has to be known to Beets before the conversion even begins. You have to specify
convert.extension
. There is no logic in Beets to determine the file format. And you cannot implement this logic externally.Ideal behaviour
I would like Beets to not need a specific file extension in the Convert plugin. This could be implemented by checking whether
convert.extension
is set. If it is, continue with the current behaviour. If it is not:dest
to some path prefix:dest = /tmp/beets/convert/tmp-song
convert.command
. Users will have to manually specify the extension they want in the command:ffmpeg -i $source -c:a flac $dest.flac
$dest
: Find/tmp/beets/convert/tmp-song.flac
dest
to the file found, and continue with linking, moving, etc.For those using shell scripts, the extension would be determined and set within the script.
This should maintain compatibility with current behaviour, and will support more powerful transcoding rules.
Related: #5346
Beta Was this translation helpful? Give feedback.
All reactions