Getting the error while using FFmpeg to record live streams

I am building a platform where a person can live stream using a camera or screen and has the option to record the stream whereas, the audience can join the stream as views.
I am using FFmpeg to record the stream in WEBM file format but getting the following error:

Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM and incorrect codec parameters
Can someone please help me with this?

1 Like

This error message indicates that you are trying to use FFmpeg to encode a file using a codec that is not supported for the WebM format. The WebM format is a container format specifically designed for use on the web, and it only supports a limited set of codecs for video, audio, and subtitles.

There are certain codec requirements for the WebM format, so be sure you are using supported codecs with the right values. You should be able to fix the issue and correctly record your live stream in WebM format by verifying that you are using VP8 or VP9 for video and Vorbis or Opus for audio, as well as by checking your version of FFmpeg and modifying the parameters as necessary.

So what should I do to fix it?

To fix this error, you will need to re-encode your video, audio, or subtitle streams using one of the supported codecs, or choose a different container format that supports the codecs you are using.

You can use the -c:v, -c:a, and -c:s options to specify the codecs for the video, audio, and subtitle streams, respectively. For example, to re-encode a video using the VP8 codec, you could use a command like this:

ffmpeg -i input.mp4 -c:v libvpx -c:a libvorbis output.webm

Remember that you may also need to use other options to specify the bitrate, resolution, and other parameters for the codecs you are using. You can find more information about these options in the FFmpeg documentation.

Otherwise, you can also try to record screen in FFmpeg

Thanks Gumlet community.