zotify-dev / zotify

A fast and customizable music and podcast downloader.
zlib License
1.09k stars 82 forks source link

--transcode-bitrate not working #134

Open gonzalomorenorovetto opened 4 months ago

gonzalomorenorovetto commented 4 months ago

The TRANSCODE_BITRATE option does nothing when encoding to mp3.

It doesn't matter what value is written

Tried as argument and as config option

What am I doing wrong?

Googolplexed0 commented 3 months ago

Fixed on my fork just now. If you don't want to deal with my changes/upgrades, I think you could fix this by replacing track.py, convert_audio_format(), lines 304-320 with:

    download_format = Zotify.CONFIG.get_download_format().lower()
    file_codec = CODEC_MAP.get(download_format, 'copy')
    bitrate = None
    if file_codec != 'copy':
        bitrate = Zotify.CONFIG.get_transcode_bitrate()
        if bitrate == "auto":
            bitrates = {
                'auto': '320k' if Zotify.check_premium() else '160k',
                'normal': '96k',
                'high': '160k',
                'very_high': '320k'
            }
            bitrate = bitrates[Zotify.CONFIG.get_download_quality()]

    output_params = ['-c:a', file_codec]
    if bitrate is not None:
        output_params += ['-b:a', bitrate]