Handbrake downsamples input audio with sample rates in excess of 48 kHz even when the selected encoder is able to handle a higher sample rate. If the selected encoder can support the sample rate of the input (and that sample rate is a predictable, well-known, common value) it should be passed through as-is, not downsampled.
Source audio with 96 kHz and 192 kHz sample rates are extremely common in LPCM sources on both DVD and Blu Ray. Handbrake does not pass-through LPCM, so the audio stream has to be converted. The 24-bit FLAC encoder is capable of handling input at this resolution but Handbrake does not pass through the value determined by the scan, instead falling back to the hard-coded maximum value of 48 kHz, per hb_audio_rates[] array in Handbrake/libhb/common.c
The (simplified) current behavior of Handbrake is to silently downsample these tracks to the closest sample rate that does not exceed the input sample rate, per hb_audio_samplerate_find_closest() in Handbrake/libhb/common.c
Please consider adding these two elements to hb_audio_rates[] and adjusting hb_audio_samplerate_xxx() functions in Handbrake/libhb/common.c so that audio with these sample rates can be used by those encoders that can support them, without breaking those encoders that cannot. At minimum, Handbrake should allow them to be passed through to the FLAC 24-bit encoder.
Code: Select all
{ { "96", 96000, }, NULL, 1, },
{ { "192", 192000, }, NULL, 1, },
Select source with LPCM audio and sample rate in excess of 48 kHz. Most 24-bit LPCM sources will have this.
Select 24-bit FLAC encoder and start the job.
Observe that scan and decode steps correctly describe sample rate of input audio
Observe that encode step states that audio will be sampled at 48 kHz
What version of HandBrake you are running:
1.0.3 and nightlies as needed
What operating system and version and you running (e.g. OSX 10.11, Windows 7, Ubuntu 14):
OSX 10.12 and Windows 10
Where did you download HandBrake from? handbrake.fr or somewhere else?
handbrake.fr
If there was any error, exception or crash report displayed, please copy it and paste it here:
No error, just not expected behavior, as these sample rates are fully supported by FLAC.
Please include the scan or encode log:
Log snippet, using a DVD source with a 24-bit, two channel, 96 kHZ LPCM audio track (24*2*96000 = 4608000):
Code: Select all
Correct identification of input track at scan time:
[11:22:25] scan: audio 0xa0bd: LPCM, rate=96000Hz, bitrate=4608000 English (LPCM) (2.0 ch)
And at decode time:
[11:22:27] * audio track 1
[11:22:27] + decoder: English (LPCM) (2.0 ch) (track 1, id 0xa0bd)
[11:22:27] + bitrate: 4608 kbps, samplerate: 96000 Hz
[11:22:27] + mixdown: Stereo
But encode step is using a lower sample rate:
[11:22:27] + encoder: FLAC 24-bit (libavcodec)
[11:22:27] + samplerate: 48000 Hz
[11:22:27] + compression level: 5.00