Wowza Community

how to control ffmpeg from modules?

Hi all:

I am writing an application which requires mux. Picture-in-picture style stuff. For now, I ingest some streams to the wowza server, and then manually execute a comand-line ffmpeg program to do the muxing, outputting another stream. This works, with acceptable latency and quality.

The question is, what is the best way to control ffmpeg from a module? Is anyone doing this at present?

One solution is just to make system commands from the Java module, but ffmpeg’s solution to any problems, like dropped streams, seems to be to simply crash. Is there some obvious way to get Java and ffmpeg to talk to each other and do appropriate things when streams go offline or change?

There’s some discussion of the Java Xuggler library, but this seems to have been dropped a couple years ago…




You can start and stop external processes in Java, but it sounds like you really want notifications. If you are pushing a rtmp stream from FFMpeg you can use IMediaStreamActionNotify3. If you are pulling mpeg-ts (as shown in these examples) then you use a combination of the IMediaStreamActionNotify (which will fire onPublish and onUnpublish for MediaCaster streams) and the IMediaCasterNotify2

If you are pulling from FFmpeg, which we recommend, you can also use the ModuleMediaCasterStreamMonitorAdvanced to monitor and reset streams automatically.


It’s working great, thank you.