ffmpeg.wasm icon indicating copy to clipboard operation
ffmpeg.wasm copied to clipboard

Proposed Encoders / Decoders Libraries

Open jeromewu opened this issue 5 years ago • 81 comments

So far only following encoders / decoders libraries are supported:

Update at 2020/11/24

Video

  • [x] mp4 (x264)
  • [x] mp4 (x265)
  • [x] webm (libvpx)
  • [x] ogv (theora)
  • [x] mpeg-1 (native)
  • [x] mpeg-2 (native)
  • [x] aom (av1 / avif) (only in next version, see comments below)

Audio

  • [x] mp3 (lame)
  • [x] aac (fdk-aac)
  • [x] wav/wv (wavpack)
  • [x] ogg (vorbis)
  • [x] opus (opus)
  • [x] flac (native)

Image

  • [x] gif (native)
  • [x] webp (libwebp)

Others

  • [x] font files (freetype)
  • [x] *.srt, *.ass subtitle files (libass) (sample code HERE)

If you there is any library you would like to add:

  • If it already exists in the replies, simply give an emoji to upvote
  • If it doesn't exist, you can reply this issue to propose.

I will check this issue periodically to decide which library to integrate next, or identify which is NOT possible to integrate at the moment.

jeromewu avatar Apr 29 '20 02:04 jeromewu

RTSP

jeromewu avatar Apr 29 '20 02:04 jeromewu

x265 / h265

jeromewu avatar Apr 29 '20 02:04 jeromewu

mpeg-1

cyberquarks avatar Apr 29 '20 09:04 cyberquarks

mpeg-2

grkblood13 avatar May 04 '20 18:05 grkblood13

AAC and WAV

  • AAC is a common audio codec for videos, and probably the next widest supported audio codec after MP3.
  • WAV is a common lossless audio format.

I don't know how WASM works, but here's how you usually use encode to AAC or WAV with FFmpeg: AAC: -c:a libdfdk_aac (requires FFmpeg to be compiled with fdk-aac) or -c:a aac (the native FFmpeg AAC encoder). lidfdk_aac is preferred as it's a higher quality AAC encoder. This may be useful: https://trac.ffmpeg.org/wiki/Encode/AAC WAV: -c:a pcm_s16le, -c:a pcm_s24le or -c:a pcm_s32le, where 16, 24 and 32 denote the output audio bit depth.

CrypticSignal avatar Jun 13 '20 23:06 CrypticSignal

Ogg please! It's important for game audio, because mp3 doesn't loop properly.

polytropoi avatar Jul 02 '20 16:07 polytropoi

AV1

samwatkinson1 avatar Jul 02 '20 16:07 samwatkinson1

gif

Cobertos avatar Oct 22 '20 18:10 Cobertos

libwebp

It would be helpful if you could provide some instructions on how to implement these libs so we can make some PRs

smashah avatar Nov 01 '20 21:11 smashah

Hi all, for the latest version (v0.9.3), more libraries supported has been added. Please check if it helps in your project.

@smashah It would be great if you can send PRs, for integrating new libraries, you can check this repo: https://github.com/ffmpegwasm/ffmpeg.wasm-core.

Also you can check this series of posts to learn more foundation:

  • https://jeromewu.github.io/build-ffmpeg-webassembly-version-part-1-preparation/
  • https://jeromewu.github.io/build-ffmpeg-webassembly-version-part-2-compile-with-emscripten/
  • https://jeromewu.github.io/build-ffmpeg-webassembly-version-part-3-v0.1/
  • https://jeromewu.github.io/build-ffmpeg-webassembly-version-part-4-v0.2/

jeromewu avatar Nov 03 '20 15:11 jeromewu

Thank you so much for creating this!

AVIF please! The AV1 standard is gaining support in the industry and is also used as a single frame "film" as an image format for the web: AVIF. Chrome is supporting it, cloudflare is supporting it and on https://blog.cloudflare.com/generate-avif-images-with-image-resizing/ Cloudflare gives a list of good reasons why both Intel and Apple is jumping on the AVIF (single frame AV1) wagon.

mathiasrw avatar Nov 05 '20 06:11 mathiasrw

For AV1, in fact I have successfully integrated into ffmpeg.wasm, but there are two main issues:

  1. It takes more than a minute to transcode an one second video
  2. It adds 2 extra MB to ffmpeg-core.wasm

So right now I disable it as it is not usable for now. For AVIF, I will check if it is slow as well.

jeromewu avatar Nov 05 '20 11:11 jeromewu

I would love more focus on audio side of things, I am not sure if it's covered with theora or vorbis. So Opus and Flac. I mentioned vorbis ogg because Opus can be in an ogg container.

knaik avatar Nov 06 '20 06:11 knaik

@jeromewu 60x to transcode - aw. Hard one. But epic that you have already looked into it.

Is there any chance to obtain the version with AV1 included even it not being part of the main release?

mathiasrw avatar Nov 06 '20 21:11 mathiasrw

@mathiasrw

I have published the version with AV1 in the next / 0.9.0-alpha.2 version, you can use it with following ways:

Node

$ npm install @ffmpeg/core@next
# or
$ npm install @ffmpeg/[email protected]

Browser

const ffmpeg = createFFmpeg({
  corePath: 'https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js',
});

jeromewu avatar Nov 07 '20 06:11 jeromewu

Hey guys, new / verified libraries are updated, please check and don't forget to upgrade to latest version of ffmpeg.wasm to use them.

jeromewu avatar Nov 17 '20 05:11 jeromewu

Any chance for h264_nvenc and hevc_nvenc (https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/)? Both of these are great and fast combined with nvidia gpus.

sejbr avatar Nov 18 '20 01:11 sejbr

@sejbr From what I know, it is impossible to use GPU capabilities right now, these two flags are impossible at the moment.

jeromewu avatar Nov 19 '20 14:11 jeromewu

You mean in web assembly? That's a shame :/.

sejbr avatar Nov 19 '20 15:11 sejbr

Thank you for your excelent work @jeromewu 👏👏! if possible add libwebp plis 🙏

EstebanFuentealba avatar Nov 19 '20 18:11 EstebanFuentealba

@smashah and @EstebanFuentealba libwebp is added in v0.9.6, please check. :smile:

jeromewu avatar Nov 24 '20 06:11 jeromewu

SRT & RIST That would be even more awesome!!

pbl4845 avatar Dec 03 '20 19:12 pbl4845

mjpeg

sminodonte avatar Dec 08 '20 15:12 sminodonte

Great work on the library. Can we support RTMP? It would be interesting to see if it's possible to stream from the browser to YouTube or Twitch.

owenthereal avatar Dec 22 '20 18:12 owenthereal

Jpeg2000

tudalex avatar Jan 07 '21 11:01 tudalex

I wish that it can work with mxf codec

videoluce avatar Jan 16 '21 12:01 videoluce

flv(x265) mpeg2ts(HEVC) mpeg2ps(HEVC)

roger912 avatar Jan 21 '21 05:01 roger912

RTSP

RTSP Support is Now Available ? because you add it this issue but in other issues you said you don't support streaming yet

amirzenoozi avatar Feb 22 '21 13:02 amirzenoozi

@amirzenoozi RTSP is still not supported, only the ones in the top of this issue are available. Sorry for the confusion.

jeromewu avatar Mar 08 '21 08:03 jeromewu

please add suppor for libass

maickoldxd avatar Mar 18 '21 03:03 maickoldxd