Fix stdout pipe deadlock in FFmpeg conversion#732
Open
HapppppyMoon wants to merge 1 commit intoTichau:integrationfrom
Open
Fix stdout pipe deadlock in FFmpeg conversion#732HapppppyMoon wants to merge 1 commit intoTichau:integrationfrom
HapppppyMoon wants to merge 1 commit intoTichau:integrationfrom
Conversation
- ffmpeg was given -progress pipe:1 which writes progress data to stdout - stdout was redirected but never read, filling the pipe buffer - Once the buffer filled, ffmpeg blocked on write and hung indefinitely - Output files had no moov atom written, resulting in unplayable files - Progress parsing already works via stderr legacy format (size=... time=...) - previously: `-n -progress pipe:1` with `RedirectStandardOutput = true` - now: `-n` with `RedirectStandardOutput = false`
There was a problem hiding this comment.
Pull request overview
This PR addresses an FFmpeg conversion hang caused by redirecting stdout while emitting progress data to pipe:1 (stdout) without consuming it, leading to a blocked FFmpeg process once the stdout pipe buffer fills.
Changes:
- Removed
-progress pipe:1from FFmpeg base arguments. - Disabled
RedirectStandardOutputfor the FFmpeg process since stdout is not read. - Kept progress tracking via existing stderr parsing (
size=... time=... bitrate=...format).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
This PR fixes a critical bug where FFmpeg conversions hang indefinitely due to a stdout pipe deadlock. The
-progress pipe:1flag writes progress data to stdout, but the application only reads stderr — causing the pipe buffer to fill and FFmpeg to block on write.Key changes
-progress pipe:1from FFmpeg base argumentsRedirectStandardOutputsince stdout is never consumedRoot cause
baseArgs(line 91)"-n -progress pipe:1""-n"RedirectStandardOutput(line 82)truefalse-progress pipe:1sends structured progress to stdout, butConvert()only readsStandardError. Once the stdout pipe buffer fills (~4-64KB), FFmpeg blocks on write → process hangs → output file never finalized (no moov atom for MP4) → unplayable file.Impact
ParseFFMPEGOutputalready parses stderr progress (size=... time=... bitrate=...)Testing
StandardOutputin the conversion pipelineConversionJob_FFMPEG.cs(2 lines changed)