Question / Help WebM Ffmpeg Icecast streaming fails with "warning: Failed to open audio codec: Invalid argument"

LukaP

New Member
Hi,

been trying to make OBS work with Icecast and VP8/VP9 + opus webm streaming. My reference is an older post from 2016 (https://obsproject.com/forum/threads/obs-studio-ffmpeg-webm-and-icecast2.50680/#post-225267) where the author provides both a screenshot and a commandline method for streaming to icecast.

In my case the comandline work, but the setup in OBS as in his screenshot doesn't. The GUI says: "An unspecified error occurred while recording." and commandline only reports:
Code:
info: ------------------------------------------------
warning: Failed to open audio codec: Invalid argument
warning: ffmpeg_data_init failed
info: ==== Recording Stop ================================================

I've started OBS with
Code:
$ obs --verbose --log_unfiltered --unfiltered_log

Here's a screenshot from setup in Recording/Advanced:
Screenshot_2019-04-15_14-10-23.png


Meanwhile, this command-line works:
Code:
ffmpeg -i A_VIDEO_FILE.mp4 \
     -f webm -cluster_size_limit 2M -cluster_time_limit 5100 -content_type video/webm \
     -vf scale=1280:-1 -r 30 \
     -ac 2 -acodec libopus -b:a 64K \
     -vcodec libvpx -b:v 2.5M -crf 30 -g 150 -deadline realtime \
     icecast://source:PASSWORD@SERVER.DOM:8888/video.webm

OBS version: 23.1.0 (64bit) on Ubuntu
- 16.04 xenial
- 18.10 cosmic

ffmpeg versions
- 3.4-1~16.04.york0
- 4.0.2

any help greatly appreciated!
(btw: does this look like a bug? should i file it as such?)
 

LukaP

New Member
I managed to make it work by switching audio encoder to libvorbis. Also I found out that Muxer Settings had wrong format. I can now use this:

Screenshot_2019-04-15_16-50-50.png


It would be still better to be able to use opus codec instead of vorbis, since it is superior to everything.

Encoding still takes so much CPU even at 480p that is pretty unusable unless your machine is crazy powerful. I hope vp9 is going to get optimized better or AV1 will be better at it. We'll probably also need to wait until Icecast supports it...
 

FirebirdTN

New Member
I know this is an old post, but thought I'd throw this out there in case anyone else stumbles upon this from a web search. Opus DOES work (at least on Windows). You have to go to the audio settings and change the sample rate from 44.1Khz to 48Khz.
 

fineman

New Member
Hi - just trying to set the same OBS/Icecast/webM chain going myself. Thanks to your posts above, I have the stream connecting to my icecast server. However, when I access the video.webm mount point, I just get a blank player. I notice that under the mountpoint details, icecast shows "server_type audio/mpeg" - I guess this may be the issue, but so far I've not fonud anywhere to configure that. I'm using Iceast 2.4.4 on Windows, OBS 22.0.2
 

fineman

New Member
OK - two updates - first, just noticed this is in Linux support - apologies. But for completeness, the issue was that I had video/webm for my content_type - needed to be video\webm
 
Top