nathom / streamrip

A scriptable music downloader for Qobuz, Tidal, SoundCloud, and Deezer
GNU General Public License v3.0
2.35k stars 209 forks source link

[BUG] 16-bit tracks are incorrectly converted to 24-bit #614

Open disconnect78 opened 5 months ago

disconnect78 commented 5 months ago

Describe the bug

The config file states that bit_depth in the conversion section is only applied if the bit depth is higher than the specified value. However, if I specify a bit depth of 24 and download a 16-bit album from qobuz, it incorrectly converts the files to 24-bit. sampling_rate is correctly applied however, in that if I specify a sampling rate of 48000, a file with a sampling rate of 44100 is not upsampled.

In other words, if my config settings are set to bit depth of 24 and sampling rate of 48000, downloading a 16/44100 track results in a 24/44100 file when I would expect it to remain 16/44100.

Command Used

rip url https://www.qobuz.com/gb-en/album/discovery-daft-punk/0724384960650

Debug Traceback

...
[16:23:55] DEBUG    Tagging with [('TITLE', 'Nightvision'), ('ARTIST', 'Daft tagger.py:253
                    Punk'), ('ALBUM', 'Discovery'), ('ALBUMARTIST', 'Daft                 
                    Punk'), ('YEAR', '2001'), ('GENRE', 'Dance,                           
                    Électronique'), ('COPYRIGHT', 'Distributed exclusively                
                    by Warner Music France / ADA France, © 2001 Daft Life                 
                    Ltd. Distributed exclusively by Warner Music France /                 
                    ADA France, ℗ 2001 Daft Life Ltd.'), ('TRACKNUMBER',                  
                    '06'), ('DISCNUMBER', '01'), ('TRACKTOTAL', '14'),                    
                    ('DISCTOTAL', '01'), ('DATE', '2001-03-07'), ('ISRC',                 
                    'GBDUW0000061')]                                                      
           DEBUG    No arguments provided. Codec defaults will be used     converter.py:66
           DEBUG    FFmpeg codec extra argument:                           converter.py:72
           DEBUG    ['ffmpeg', '-i', './Daft Punk - Discovery (2001)      converter.py:148
                    [FLAC] [16B-44.1kHz] [3142537]/6. Daft Punk -                         
                    Nightvision.flac', '-c:a', 'alac', '-c:v', 'copy',                    
                    '-af', 'aformat=sample_rates=48000|44100',                            
                    '-sample_fmt', 's32p', '-y',                                          
                    '/var/folders/wz/6p4nwyd50cl30_25y9hvxwpm0000gn/T/6.                  
                    Daft Punk - Nightvision.m4a']                                         
           DEBUG    Generated conversion command: ['ffmpeg', '-i', './Daft converter.py:85
                    Punk - Discovery (2001) [FLAC] [16B-44.1kHz]                          
                    [3142537]/6. Daft Punk - Nightvision.flac', '-c:a',                   
                    'alac', '-c:v', 'copy', '-af',                                        
                    'aformat=sample_rates=48000|44100', '-sample_fmt',                    
                    's32p', '-y',                                                         
                    '/var/folders/wz/6p4nwyd50cl30_25y9hvxwpm0000gn/T/6.                  
                    Daft Punk - Nightvision.m4a']                                         
...

Config File

...
[qobuz]
# 1: 320kbps MP3, 2: 16/44.1, 3: 24/<=96, 4: 24/>=96
quality = 3
...
# Convert tracks to a codec after downloading them.
[conversion]
enabled = true
# FLAC, ALAC, OPUS, MP3, VORBIS, or AAC
codec = "ALAC"
# In Hz. Tracks are downsampled if their sampling rate is greater than this. 
# Value of 48000 is recommended to maximize quality and minimize space
sampling_rate = 48000
# Only 16 and 24 are available. It is only applied when the bit depth is higher
# than this value.
bit_depth = 24
# Only applicable for lossy codecs
lossy_bitrate = 320
...

Operating System

macOS

streamrip version

2.0.5

Screenshots and recordings

No response

Additional context

No response