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

Can i convert WEBM to MP3? #159

Open
wemersonrv opened this issue Apr 2, 2021 · 0 comments
Open

Can i convert WEBM to MP3? #159

wemersonrv opened this issue Apr 2, 2021 · 0 comments

Comments

@wemersonrv
Copy link

Hello,

Can i convert from audio/webm to mp3 ?

I am trying like this:

const originFile = 'myAudio.webm'
const dstFile= 'myAudio.mp3'

const testData = new Uint8Array(fs.readFileSync(`./${originFile}`))
const result = ffmpeg({
          MEMFS: [{ name: originFile, data: testData }],
          arguments: [ '-i', originFile, '-vn', '-ab', '128k', '-ar', '44100', '-y', dstFile ],
        })

const out = result.MEMFS[0]
fs.writeFileSync(`./${dstFile}`, Buffer(out.data))

And receiving this kind of result:

ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
  configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libvpx_vp8 --enable-encoder=libopus --enable-muxer=webm --enable-muxer=ogg --enable-muxer=null --enable-libopus --enable-libvpx --extra-cflags='-s USE_ZLIB=1 -I../libvpx/dist/include' --extra-ldflags=-L../libvpx/dist/lib
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
[opus @ 0x6a9ef0] Warning: not compiled with thread support, using thread emulation
Input #0, matroska,webm, from 'myAudio.webm':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
[NULL @ 0x6aaa00] Unable to find a suitable output format for 'myAudio.mp3'
myAudio.mp3: Invalid argument

// TypeError: Cannot read property 'data' of undefined
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

1 participant