Fix ffmpeg backend misidentifying metadata as audio stream info#157
Open
gaoflow wants to merge 1 commit into
Open
Fix ffmpeg backend misidentifying metadata as audio stream info#157gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
When a file's metadata contains the substring "audio:" (e.g. a
description tag reading "audio: broken"), _get_info() would stop reading
ffmpeg's stderr on that metadata line instead of continuing to the real
stream descriptor ("Stream #N:M: Audio: …"). This caused all three
parsed values – channels, samplerate, and duration – to be silently set
to 0.
The fix requires the matched line to also contain "stream #", which is
always present in ffmpeg's stream info lines but never in metadata lines.
Fixes beetbox#119.
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.
What
When a file's metadata contains the substring
"audio:"(e.g. adescription tag whose value reads
"audio: broken"),_get_info()inthe ffmpeg backend stops reading stderr on that metadata line instead of
continuing until the real stream descriptor (
Stream #N:M: Audio: …).This silently produces
channels = 0,samplerate = 0, andduration = 0for the decoded file, which causes playback failures downstream.
Why it happens
ffmpeg prints file metadata before the stream table, so any tag whose
value contains
"audio:"hits this branch first:Fix
Require
'stream #'to also be present on the matched line. ffmpegalways prefixes stream entries with
Stream #N:M:, so the real audioline always contains both substrings, while metadata value lines never
contain
'stream #'.Closes #119.
This pull request was prepared with the assistance of AI, under my direction and review.