-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Set AAC codec for audio in mp4 files, add transcoding utility #3956
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
behackl
merged 6 commits into
ManimCommunity:main
from
achille-fouilleul:mp4-format-set-aac-codec
Oct 19, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
865bd39
scene_file_writer: convert frame_rate to fraction
achille-fouilleul 8693fe5
Set audio codec to AAC when format=mp4
achille-fouilleul 8091f7c
refactor: change import uv.utils.Fraction -> fractions.Fraction
behackl 1835c2a
use config as single source of truth for container format
behackl cad6558
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b85a308
Merge branch 'main' into mp4-format-set-aac-codec
behackl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, where did these numbers come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I should have added a comment about these epsilons.
pyav wants fractions but at this point in the code all we have is a float. Though, strictly speaking, IEEE 754 floats are fractions, converting from floats to meaningful fractions is not obvious. I say meaningful because floats can only represent powers of two so something like (50 * 2 / 3) does not have an exact representation in binary. For (50 * 2 / 3),
Fraction.from_float
does not returnFraction(100, 3)
, as one would naïvely expect:If a frame rate is obtained via some calculation, implicit float rounding rules may result in frame rate values like 49.999... instead of 50.
Fraction.from_float
returns:Using this value rather than
Fraction(50, 1)
could lead to subtle issues.I don't think this problem may be solved in general. I made the assumption that frame rates would be either whole values or multiples of 1000 / 1001 (because NTSC) specified with two decimals.
I chose epsilon1 and epsilon2 such that:
If the need to support other fractions arises, this function will have to be revisited.