Repository navigation
downloads can be saved as flac, in 16 bit since every source is lossy - #15
Merged
1 commit merged intoOct 21, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
… lossy Settings > Downloads gains a FLAC choice next to Original, MP3 and Opus. yt-dlp extracts with --audio-format flac and no bitrate, and ffmpeg writes 16-bit samples: the sources are YouTube and SoundCloud streams, so the bits a 24-bit decode adds are noise FLAC cannot compress, and dropping them makes the file about half the size. Cover art and lyrics go in through the same lofty path as the other formats, and the completed-file detection already knew the flac extension.
a1510fb
Member
|
Merged, thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Settings > Downloads offers Original, MP3 and Opus. Some players and libraries only take FLAC, so a FLAC choice joins them.
The sources are YouTube and SoundCloud streams, so FLAC here does not mean lossless audio: the file is only as good as the lossy stream it came from. What it does avoid is a second lossy encode on top. The help text and the changelog say that, rather than promising lossless quality.
yt-dlp extracts with
--audio-format flacand no--audio-quality, since a lossless encoder has no bitrate to aim for, andExtractAudio:-sample_fmt s16makes ffmpeg write 16-bit samples. Without it the decode lands at 24 bit, and the extra bits are decoder noise FLAC cannot compress: on "Me at the zoo" the file goes from 1.37 MB at 24 bit to 504 KB at 16 bit. The existingffmpeg:-threads 1still reaches both postprocessors.Cover art and lyrics go in through the same lofty path as every other format, and
find_output_filealready knew the flac extension, so nothing else in the pipeline changes. One new test runsembed_tagsagainst a real FLAC with the block layout ffmpeg writes and checks that title, artist, lyrics and the front cover come back out. Another checks the yt-dlp arguments and that the setting serialises as"flac".Worth knowing
"flac"intodownloads.json, the frozen settings of history entries included. v1.2.1 and older cannot read that and the daemon does not start, so going back to an older build after choosing FLAC needs the history cleared. Lettingload()fall back toOriginalfor an unknown format would stop this from happening with the next format; I left that out of this PR.write_mediaruns inspawn_blocking, so it would end as a warning anyway.Verified
scripts/release-check.sh: release checks completed, with the UI built.cd ui && pnpm check && pnpm build,cargo fmt --all -- --check,cargo test --workspace --locked(skipping the mpv gain test like CI): pass.audio.flac, 16 bit, 48 kHz, blocks STREAMINFO / VORBIS_COMMENT / PADDING, title embedded.Not seen in a running client: I did not click through Settings > Downloads on a build from this branch.