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

Bug修正 #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Bug修正 #9

wants to merge 2 commits into from

Conversation

PockerKID
Copy link

  • 修正单声道PCM转MP3播放变快的问题
  • 修正只初始化一次时,多次调用转换只有第一次正常的问题

@tim162
Copy link

tim162 commented Nov 15, 2020

@PockerKID I have the exact bug that the converted MP3 file from an input WAV file has different durations and can't figure out why. Is it possible to use your PR as the library as it seems you fixed that bug?
Or @JinJieGu could you maybe merge the PR so we can use the fixed version?

@PockerKID
Copy link
Author

@PockerKID I have the exact bug that the converted MP3 file from an input WAV file has different durations and can't figure out why. Is it possible to use your PR as the library as it seems you fixed that bug?
Or @JinJieGu could you maybe merge the PR so we can use the fixed version?

Hi @tim162 , I used this library four months ago to convert pcm or wav file to mp3, and i found that there would be problems when converting mono files, it‘s’ similar to issues #2 , #3 and #4 . After searching, I found this library does not handle mono conversion, so i forked and modified it refer to Audio speed changes on converting WAV to MP3

The other problem I fixed was related to multiple conversions. I have multiple files to convert. These files have the same sampling rate, sound channel and other parameters. I only called Mp3Converter.init method once, and found that only the first conversion was normal, so i modified it.

I don’t know if your problem is caused by the above problems, you can download source code from my repo and compile aar file to try to solve your problem. (I tried to compile on Jitpack.io, but an error was reported. XD)

@tim162
Copy link

tim162 commented Nov 16, 2020

@PockerKID Thanks for your help. I was able to compile your version to .aar and convert the files using your version. Unfortunately the duration of the converted .MP3 file is still different from the original .WAV file.

I am using Mp3Converter.init(44100, 1, 0, 44100, 128, 7); and tried all three modes. I tested it with a WAV file that i recorded. Original wav file has exactly 1 minute duration. MP3 files with mode 0 and 2 (CBR and ABR) have length of 27 seconds. With mode 1 (VBR) it converted to 58 seconds. As I am trying to convert much longer files I tried VBR with a 10 min wav file and it converted to 9:38 min.

Changing channel to 2 makes the sound play faster. Am I doing sth wrong or maybe still bugs?

@PockerKID
Copy link
Author

Hi @tim162 , I tested some longer wav files and tried to convert them. The problem you mentioned did occur, but I'm sorry, I haven't found what caused the problem. Before, I mainly converted pcm to mp3. I rarely converted wav files. At the time, there were only a few short wav files, so I didn’t find this problem.
I think there are still bugs. I’m sorry that I’m very busy lately and I don’t have time to investigate the cause of the problem in detail. If I fix the bug in the future, I will notify you. Similarly, if you have a solution, please let me know. Thank you!

@tim162
Copy link

tim162 commented Nov 16, 2020

@PockerKID Yeah thanks for your help! I also didn't find the cause of the problem.
If you need the conversion right now, you can check out https://github.com/tanersener/mobile-ffmpeg. I am using it now and the duration changes at maximum about 4-5 seconds for a 8 hour file which is okay.

Nevertheless I would prefer using this library as it's very convenient and small (the other one increased apk size from 5 mb to 40 mb). So if anyone stumbles across that bug in the future and knows a fix, let me know. Thanks!

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