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

Unable to transcode to mp3 #44

Closed
MNoya opened this issue Apr 1, 2020 · 3 comments
Closed

Unable to transcode to mp3 #44

MNoya opened this issue Apr 1, 2020 · 3 comments

Comments

@MNoya
Copy link

MNoya commented Apr 1, 2020

Describe the bug
Calling transcode with a .mp3 output (with no options) results in an error:

Here's the relevant ffmpeg log:

Automatic encoder selection failed for output stream #0:0. Default encoder for format mp3 (codec mp3) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:0

I did some digging on this and found FFmpeg can be run with the command -acodec libmp3lame.
Adding that as the transcode options results in another error, with this log:

Unknown encoder 'libmp3lame'
Invalid encoder type 'libmp3lame'

To Reproduce

  1. createWorker, load and write any audio file as input
  2. transcode using .mp3 as the output extension

Expected behavior
worker.transcode succeeds creating mp3 output

Desktop:

  • OS: Ubuntu
  • Browser: Chrome
  • Version: 80

Additional context

I looked into another javascript implementation of the ffmpeg library which has transcoding to MP3 implemented (https://js-audio-converter.com/) and noticed they have --enable-encoder=libmp3lame into the configuration log, while this version of the library does not.

image

Does this mean I need to comple FFmpeg with Emscripten on my own and add that configuration line to the build?

Please let me know if I'm doing something wrong here.

Thanks in advance.

@kilisio
Copy link

kilisio commented Apr 1, 2020

yes, you will need to first compile libmp3lame with emscripten then add and enable it in ffmpeg before compiling ffmpeg. you can reference https://github.com/Kagami/ffmpeg.js/blob/master/Makefile

@MNoya
Copy link
Author

MNoya commented Apr 3, 2020

Following the tutorial on this repo's Readme at https://itnext.io/build-ffmpeg-webassembly-version-ffmpeg-js-part-1-preparation-ed12bf4c8fac I'm afraid I was not able to compile ffmpeg following the proposed steps.

I will try to use the ffmpeg compilation on https://js-audio-converter.com/js/ffmpeg-worker-all.js and change ffmpeg-core.js to use this version instead.

@jeromewu
Copy link
Collaborator

ffmpeg.js supports mp3 since v0.8.0 🎉
You can upgrade and try if there is any issues, 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

No branches or pull requests

3 participants