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

Make MPEG file to have a valid header #494

Closed
wants to merge 2 commits into from

Conversation

majonezz
Copy link

My dirty hack to repair broken header of MPEG files. Now i'm finally able to send files via a messenger like WhatsApp or so and they are playable there.

My dirty hack to repair broken header of MPEG files. Now i'm finally able to send files via a messenger like WhatsApp or so and they are playable there.
@gabeschine
Copy link
Collaborator

Thank you for submitting a work-around. I am not sure if this is the right issue, but it looks like issue #410 is the relevant one in this case?

Do you have a reproduction that we might be able to use to write a test case for this work-around? If not, how are you validating that the work-around does in fact fix the issue in all cases?

@majonezz
Copy link
Author

Hello. Sorry for a late answer. This workaround is close to #410 but not the same case. It's just adding a little bit of silence to beginning of each file which appear to cure a bad header of the file and allow to pass it via internet communicators. Without a patch, file starts with "LAME" header (4C 41 4D 45) which is not a correct header for MPEG file. That's why i.e. WhatsApp don't allow direct drop-in of that kind of file. Valid MPEG header starts with 0xFF. To reproduce the case just drop an exapmle mp3 file to a chat of https://web.whatsapp.com/ before and after applying the patch. This patch is not fixing artifacts that can occur later in the file since i don't have an idea what cause them.

@gabeschine gabeschine self-requested a review February 23, 2025 01:18
@gabeschine gabeschine self-assigned this Feb 23, 2025
@gabeschine
Copy link
Collaborator

Thank you for your patience. I'll be working on this project again next week.

@gabeschine
Copy link
Collaborator

I've had a chance to dig in. There are three issues with mp3 encoding. One of them leads to an invalid initial header.

I'll be working on a PR and when it's ready I'd really appreciate it if you would test it in your setups for extra verification.

@gabeschine gabeschine removed their assignment Feb 27, 2025
@gabeschine
Copy link
Collaborator

Would you be willing to test #499 and see if that fixes the issue you encountered with the bad initial header?

@majonezz
Copy link
Author

majonezz commented Mar 3, 2025

Hello. I'm testing #499 and it seems it fixed the file header. I'm leaving the program running and we will see if it fix the artifacts as well. Thank you for the fix. Edit: at the first glance, it fixed the artifacts as well.

@gabeschine
Copy link
Collaborator

Hello. I'm testing #499 and it seems it fixed the file header. I'm leaving the program running and we will see if it fix the artifacts as well. Thank you for the fix. Edit: at the first glance, it fixed the artifacts as well.

Great news! Thank you. Please keep me posted on your long-term testing.

@gabeschine
Copy link
Collaborator

Fixed via: #499

@gabeschine gabeschine closed this Mar 9, 2025
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

Successfully merging this pull request may close these issues.

2 participants