Skip to content
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

Add parameter for ensuring mp3 compression output length is the same as the input length #314

Open
iver56 opened this issue Feb 6, 2024 · 3 comments

Comments

@iver56
Copy link
Owner

iver56 commented Feb 6, 2024

No description provided.

@atamazian
Copy link
Contributor

Can you elaborate how the code should react if mp3 compression output length is different from original input length?

@iver56
Copy link
Owner Author

iver56 commented Mar 4, 2024

I haven't given it a lot of thought, but created this issue because I guess most people would like their compressed audio to have the same length as the input for this transform. I've seen some people write their own workarounds. Sometimes a round trip via mp3 adds a bit of silence, sometimes on the order of 40-50ms, to the start of the audio snippet, and I guess this causes it to become longer. As the "silent prefix" can have a variable length, it is not always trivial to align it. A simple solution would be to use something like AdjustDuration (padding and/or trimming) to make sure the output length is the same as the input length, while a more complicated solution would be to find the ideal alignment and chop away the excess, maybe with https://github.com/nomonosound/fast-align-audio

What do you think?

@atamazian
Copy link
Contributor

I think we should implement AdjustDuration for a start. Later, if necessary, more complicated solution may be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants