Skip to content

Add sample_format to audio metadata #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2025

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Mar 13, 2025

Towards #549

This PR adds the sample_format field to AudioStreamMetadata. In terms of values, it'll be what av_get_sample_fmt_name() returns, so it's a bit "ffmpeg-like": flt, fltp, s16, s32... Maybe we'll want to expose a more user-friendly string? I'm not sure, either way, we can always re-map as follow-ups.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 13, 2025
@@ -90,6 +90,7 @@ def test_get_metadata(metadata_getter):
)
assert best_audio_stream_metadata.bit_rate == 128837
assert best_audio_stream_metadata.codec == "aac"
assert best_audio_stream_metadata.sample_format == "fltp"
Copy link
Member Author

Choose a reason for hiding this comment

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

Hard-coded value here and below, this test already has lots of these.

# decoded frames.
self._reference_frames[stream_index] = torch.load(
frames_data_path, weights_only=True
)
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add the corresponding reference frames in #556

Copy link
Member Author

Choose a reason for hiding this comment

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

Also adding this new asset, not strictly needed for this PR, but still useful to check a format that's not fltp.
It will be needed in #556 anyway. It's from TorchAudio.

@NicolasHug NicolasHug merged commit 8e611bb into pytorch:main Mar 14, 2025
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants