Skip to content

Commit 4590ae2

Browse files
committed
Use --force-rf64-format when decoding FLACs.
FLAC decodes to the standard WAV format by default, and makes no consideration when a file requires more than 4GiB to do so, instead exiting with an error. FLAC supports two alternative formats to workaround the limitation, rf64 and wave64. I picked rf64 somewhat arbitrarily, and also because ffmpeg considers it an extension of WAV. For CD quality audio, which is 16-bit 441000 Hz stereo, this would require a FLAC over 6 hours and 45 minutes to run into the issue. However, it does rapidly become an issue with greator sample sizes, rates, and channels. If you rip a Blu-ray Disc, for example, with a 7.1 soundtrack at 24-bit 192 kHz (not atypical), the uncompressed audio would exceed 4GiB in just under 16 minutes. Relatively rare limitation to bump into, but here’s the fix. 😀
1 parent 22ff4f9 commit 4590ae2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reflac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ recompress()
6363
-- "$flac"
6464

6565
if [ $VERBOSE -gt 1 ]; then
66-
flac --output-prefix="$TMPDIR/" -d -- "$flac"
66+
flac --force-rf64-format --output-prefix="$TMPDIR/" -d -- "$flac"
6767
flac --delete-input-file -$FLAC_LEVEL -- \
68-
"$TMPDIR/$(basename -s flac -- "$flac")wav"
68+
"$TMPDIR/$(basename -s flac -- "$flac")rf64"
6969
else
70-
flac -s --output-prefix="$TMPDIR/" -d -- "$flac"
70+
flac -s --force-rf64-format --output-prefix="$TMPDIR/" -d -- "$flac"
7171
flac -s --delete-input-file -$FLAC_LEVEL -- \
72-
"$TMPDIR/$(basename -s flac -- "$flac")wav"
72+
"$TMPDIR/$(basename -s flac -- "$flac")rf64"
7373
fi
7474

7575
metaflac --no-utf8-convert \

0 commit comments

Comments
 (0)