Skip to content

[FFmpeg] Add .dsf to extension list (DSD support) - #1336

Merged
flyingmutant merged 2 commits into
cmus:masterfrom
gavtroy:ffmpeg-dsd
Sep 22, 2024
Merged

flyingmutant merged 2 commits into
cmus:masterfrom
gavtroy:ffmpeg-dsd

Conversation

@gavtroy

@gavtroy gavtroy commented Jun 3, 2024 •

Copy link
Copy Markdown
Collaborator

+ resample to a lower sample rate if needed, as some variants of DSD exceed the 524kHz we support internally -- and the 384kHz limit of at least some outputs (pulse).

Fixes #796.

Comment thread ip/ffmpeg.c Resolved
@pgaskin

pgaskin commented Sep 16, 2024

Copy link
Copy Markdown
Member

@gavtroy, are you still working on this?

@gavtroy

gavtroy commented Sep 18, 2024 •

Copy link
Copy Markdown
Collaborator Author

I looked into why the limit was 384000 and the resampling was actually working fine, the limit was from the output side (pulse).

Do note that although this seems to work fine I'm not absolutely confident if it's "right". Forcing a higher sample rate to a lower sample rate like this behaves completely normally, but doing the opposite is clearly broken - the audio cuts off early and seeking is a bit weird. I think it probably just breaks some assumption we make about the output not growing and that the high->low case is fine, but ideally I'd understand it properly and right now I just don't have the energy to do that. In any case we only downsample when it's >384000 so this isn't relevant for pretty much anything except DSD128.

By the way if it's helpful, I just searched https://archive.org/search?query=dsd128 for something to test that case.

@gavtroy
gavtroy marked this pull request as ready for review September 18, 2024 00:42

@pgaskin pgaskin left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense, shouldn't cause regressions, and seems to work fine with DSD on AAudio and PulseAudio.

The bugfix also fixes playback of 24/32-bit files with ffmpeg.

I think it probably just breaks some assumption we make about the output not growing and that the high->low case is fine, but ideally I'd understand it properly and right now I just don't have the energy to do that

It's not apparent to me either, but this works, and why higher sample rates don't is something we can figure out later, probably when I implement #1328.

In any case we only downsample when it's >384000 so this isn't relevant for pretty much anything except DSD128.

Agreed. This change doesn't affect lower sample rates, and ones higher than this are rarely seen in mainstream formats.

@pgaskin

pgaskin commented Sep 20, 2024

Copy link
Copy Markdown
Member

@flyingmutant, this should be rebase-merged since the sample size fix commit is a separate (but related) bugfix.

+ resample to a lower sample rate if needed, as some variants of DSD
exceed the 524kHz we support internally -- and the 384kHz limit of at
least some outputs (pulse).

Fixes cmus#796.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DSD support

3 participants