refactor(audio_processing): replace pipe with temp files for FFmpeg p…#37127
Draft
joeyhacker wants to merge 1 commit intohuggingface:mainfrom
Draft
refactor(audio_processing): replace pipe with temp files for FFmpeg p…#37127joeyhacker wants to merge 1 commit intohuggingface:mainfrom
joeyhacker wants to merge 1 commit intohuggingface:mainfrom
Conversation
…rocessing
This change replaces the previous pipe-based FFmpeg audio decoding approach
with temporary file operations to improve reliability, especially for
container formats like MP4/m4a.
Key reasons for this change:
1. MP4 container format requires random access to metadata (moov atoms)
which is often located at the end of the file. Pipe streaming makes
this access pattern impossible.
2. FFmpeg's format detection works more reliably with physical files
compared to streamed input via pipes.
3. Temporary files provide better error diagnostics since the input can
be preserved for debugging when failures occur.
4. Some FFmpeg codecs and filters behave differently with pipe input
versus file input due to buffering differences.
The new implementation:
- Creates properly named temporary files with correct extensions
- Uses atomic write operations with flush()
- Implements comprehensive cleanup in finally blocks
- Provides better error messages when failures occur
This fixes issues with partial file errors ("offset 0x3f9: partial file")
that occurred during demuxing of m4a files in the pipe-based approach
Contributor
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
Member
|
I think this makes sense for pipelines and I agree that media files often require seeking that is incompatible with piping/streaming. cc @eustlb for audio, WDYT? |
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.
…rocessing
This change replaces the previous pipe-based FFmpeg audio decoding approach
with temporary file operations to improve reliability, especially for
container formats like MP4/m4a.
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.