Repository navigation
Conversation
The old plain `-c copy` only kept the first audio stream during remuxig the media. However, if the first audio is not decodable by ffmpeg (e.g.: apac in a sample video), later ffmpeg executions will fail, even if it would be able to execute the transcode using the non-default audio stream. The new code detects if there are any non-decodable audio streams and pick the first decodable if need to.
Running the remux could change the number of audio streams as it only keeps the first one. However, the memoized audio_streams instance variable was never cleaned up, hence a later ffmpeg command tried to map the second audio stream (marked decodable using the cache, but it had a different index by that time) and generated a non-valid ffmpeg command. New code cleans up the memoized instance variables to avoid this situation.
kiskoza
force-pushed
the
fixes/remux-with-undecodable-audio
branch
from
November 12, 2026 14:41
1767abe to
f2eb668
Compare
kiskoza
force-pushed
the
fixes/remux-with-undecodable-audio
branch
from
November 12, 2026 14:57
f2eb668 to
616007e
Compare
kiskoza
marked this pull request as ready for review
November 12, 2026 15:28
viktor-duka-inst
approved these changes
Nov 13, 2026
viktor-duka-inst
left a comment
There was a problem hiding this comment.
I trust you on the root cause fix, the change does exactly what is described in the PR
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.
drop undecodable audio streams before remux
The old plain
-c copyonly kept the first audio stream during remuxigthe media. However, if the first audio is not decodable by ffmpeg (e.g.:
apac in a sample video), later ffmpeg executions will fail, even if it
would be able to execute the transcode using the non-default audio
stream.
The new code detects if there are any non-decodable audio streams and
pick the first decodable if need to.
reset internal data properly on load
Running the remux could change the number of audio streams as it only
keeps the first one. However, the memoized audio_streams instance
variable was never cleaned up, hence a later ffmpeg command tried to map
the second audio stream (marked decodable using the cache, but it had a
different index by that time) and generated a non-valid ffmpeg command.
New code cleans up the memoized instance variables to avoid this
situation.