[FFmpeg-user] Trouble with ffmpeg ... -f tee and specific encodings per output

Jason Bailey JBailey at emerytelcom.com
Thu Feb 22 09:14:36 EET 2024

I'm trying to use "ffmpeg ... -f tee" to take a single RTMP input and slice it into two entirely different outputs -- one as a mpegts stream to specific host, and another as HLS output. Just when I think I've about got it figured out, I run into a brick wall. I've read a lot of documentation, but I'm not quite wrapping my head around all of it.

The tricky part is that the the mpegts output has very specific requirements -- it needs to be MPEG2TS with AC3 audio. The HLS output, however, should use HLS appropriate defaults -- h264 video, aac audio.

So with tee, should I be including the output specific parameters (encoding, bitrate, etc) in between the brackets like ".... -f tee [f=mpegts:vcodec=ac3]" (which seems to result in errors) or should it come in an additional form (before the tee is specified)? Is this a bad use case for tee?

The basic command I have (without encoding, etc) is something like this:

/usr/bin/ffmpeg -listen 1 rtmp:// -f tee "[f=mpegts]udp://|[f=hls]stream.m3u8"

I'm just not sure how I tell ffmpeg that the mpegts output should be encoded with ac3 audio, for example, and the hls should be encoded using aac audio?

I'm just not connecting all the pieces -- I'm missing something!


*Confidentiality Notice* This email message may contain legally privileged and/or confidential information. If you are not the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this email message is strictly prohibited. If you have received this email in error, please immediately notify the sender and delete this email message from your computer.

More information about the ffmpeg-user mailing list