Resampling of lossless audio files depending on samplerate

Issue #831 new
Former user created an issue

I would like to be able to resample lossless audio files (FLAC, WAV etc.) to a different samplerate. The reason for this is that not all DACs support all samplerates. Depending on the DAC I want to be able to downsample hirez files to a samplerate that the DAC can process. The resampling should be in integer ratio, as non integer ratio resampling uses more processor power at a given level of accuracy. An example profile.xml entry to do this would look something like this:

   <Transcoding>
        <Audio targetContainer="lpcm" aSamplerate="44100">
            <Matches container="flac" aSamplerate="88200"/>
            <Matches container="wavpack" aSamplerate="88200"/>
            <Matches container="flac" aSamplerate="176400"/>
            <Matches container="wavpack" aSamplerate="176400"/>
        </Audio>
        <Audio targetContainer="lpcm" aSamplerate="48000">
            <Matches container="flac" aSamplerate="96000"/>
            <Matches container="wavpack" aSamplerate="96000"/>
            <Matches container="flac" aSamplerate="192000"/>
            <Matches container="wavpack" aSamplerate="192000"/>
        </Audio>
    </Transcoding>

To maximise the quality of the resampling, ffmpeg should make use of sox for the resampling if possible. https://trac.ffmpeg.org/wiki/FFmpeg%20and%20the%20SoX%20Resampler

Thanks a lot

Comments (8)

  1. Petr Nejedly repo owner

    Similar issue to this: http://forum.serviio.org/viewtopic.php?f=7&t=18268&p=98182#p98182

    Thinking it could be better to have these resampling rules hardcoded to keep the profiles clean (as DLNA only supports 44.1 and 48 for LPCM)

    Something like:

    if(targetContainer == LPCM) {
      if(file.samplerate in (44.1 / 88.2 / 176.4 / 352.8kHz )) {
        targetSamplerate = 44.1KHz
      } else if (file.samplerate in (48 / 96 / 192 / 384kHz)) {
        targetSamplerate = 48KHz
      }
    }
    

    How does that sound?

  2. Former user Account Deleted

    +1.

    I noticed on the Sony BDP-S370 that FLAC files with a sample rate > 48,000hz don't show up unless a rule is added to match the FLAC container and transcode all such files to LPCM with a supported sample rate (e.g. 48,000hz). I've only tried 44,100hz, 48,000hz, 96,000hz, 176,400hz sample rate files so far.

  3. Log in to comment