Opened 6 months ago

Last modified 6 months ago

#8705 new defect

content_type option is not working with tee output

Reported by: animtim Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: tee
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When using ffmpeg to send a webm video stream to an icecast server, it needs the option -content_type video/webm . It works fine for a single output, but when using a tee output (to both send the stream to the server and save to disk for example), the -content_type option is lost and default value (audio/mpeg) is used instead, so the stream on the icecast server is not readable.

I could workaround the issue locally by editing libavformat/icecast.c to replace the default value to video/webm and rebuild ffmpeg, but of course this is not a solution for most users...

Also, I tried to pass the option to the corresponding tee output but it was not recognized/not working.

So I guess it is a bug to fix... Or maybe I missed something?

How to reproduce:

-install an icecast server, with a mountpoint for video.webm, and of course adapt the source, password and url in the command below:

ffmpeg -video_size 1920x1080 -thread_queue_size 512 -framerate 30 -f x11grab -i :0.0+0,0 \
  -thread_queue_size 512 -f pulse -ac 2 -i default \
  -f webm -cluster_size_limit 2M -cluster_time_limit 5100 -content_type video/webm \
  -vf scale=640:-1 \
  -acodec libvorbis -aq 4 \
  -vcodec libvpx -b:v 1000K -crf 40 -g 150 -deadline good -threads 2 \
  -f tee -map 0:v -map 1:a "icecast://source:password@example.domain:8000/video.webm|savedVideo.webm"

ffmpeg version 4.1.5 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8.4.0 (Mageia 8.4.0-1.mga7)

Note: tested with several distribution packages (Debian stable and sid, Manjaro), issue is the same.

Change History (8)

comment:1 Changed 6 months ago by Cigaes

You need to set the content_type option on the icecast output of the tee muxer, not on the tee muxer itself. Otherwise, what tee should do if muxing to WebM on one side and to Ogg on the other?

comment:2 Changed 6 months ago by animtim

Yes, though I tried to pass the content type option to the icecast output like this:

"[content_type=video/webm]icecast://source:password@example.domain:8000/video.webm|savedVideo.webm"

But it doesn't work, with this console output:

[icecast @ 0x26a4e40] Streaming WebM but appropriate content type NOT set!
[icecast @ 0x26a4e40] Set it with -content_type video/webm
[webm @ 0x268ca00] Unknown option 'content_type'
[tee @ 0x1a21180] Slave muxer #0 failed, aborting.
Could not write header for output file #0 (incorrect codec parameters ?): Option not found
Error initializing output stream 0:1 --

So, is there another way to pass the option to the icecast output that I missed?

comment:3 Changed 6 months ago by Cigaes

There is a problem. This syntax can only set format options, not protocol option. It should allow to set protocol options.

In the meantime, you can set protocol options with an ugly syntax, something like, IIRC, icecast,,content_type,video/webm,,://....

comment:4 Changed 6 months ago by animtim

ah! so I was not crazy, there is indeed a problem... "good" :)

I tried the syntax you suggested but it also doesn't work
(and I couldn't find any mention about it in the doc to check if it was correct):

[tee @ 0xaa3180] Slave 'icecast,,content_type,video/webm,,://source:password@example.domain:8000/video.webm': error opening: No such file or directory
[tee @ 0xaa3180] Slave muxer #0 failed, aborting.
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
Error initializing output stream 0:1 --
Last edited 6 months ago by animtim (previous) (diff)

comment:6 Changed 6 months ago by animtim

Thanks, I'll test your patch tonight and let you know if it works.

comment:7 Changed 6 months ago by cehoyos

  • Keywords tee added
  • Version changed from unspecified to git-master

comment:8 Changed 6 months ago by animtim

I tested your patch, it works perfectly.

(as in, now "[content_type=video/webm]icecast://source:password@example.domain:8000/video.webm|savedVideo.webm" works as expected )

I hope this patch will be included in next release :)

Thanks for your fast answers and for the fix, great work!

Note: See TracTickets for help on using tickets.