Hi,
I need to run a process using java’s Runtime.getRuntime().exec() when a stream gets unPublished. So I implemented IMediaStreamActionNotify3 on my Module and registered the notifier with the stream. In onUnPublish(), I tried to execute Runtime.getRuntime().exec(). As i can see, it starts the process, but execution of the created process just hangs(i can see process name in my taskmanager with 0% cpu and no change in memory). If I close the instance of the server, the created process executes and gives me desired output.
Note : Am running wowza in windows 8/64 bit. Behaviour is same if i run server instance from eclipse or as standalone application(startup.bat) . If i execute the same command through simple java class with a main() method, it just works fine.
Command i was executing was:
"ffmpeg -y -i in.mp4 -i in2.mp4 -filter_complex “[0] trim=start=40:end=70:duration=30, setpts=PTS-STARTPTS, scale=512:288 [v2] ;[0] trim=start=60:end=80:duration=20, setpts=PTS-STARTPTS, scale=512:288 [v1] ; [1] trim=start=0:end=30:duration=30, setpts=PTS-STARTPTS, scale=512:288 [v4] ; [1] trim=start=20:end=40:duration=20, setpts=PTS-STARTPTS, scale=512:288 [v3] ; [v2][v4][v1][v3] concat=n=4:v=1:a=0 [outv]; [0] atrim=start=40:end=70:duration=30, asetpts=PTS-STARTPTS [a2] ;[0] atrim=start=60:end=80:duration=20, asetpts=PTS-STARTPTS [a1] ; [1] atrim=start=0:end=30:duration=30, asetpts=PTS-STARTPTS [a4] ; [1] atrim=start=20:end=40:duration=20, asetpts=PTS-STARTPTS [a3]; [a2][a4][a1][a3] concat=n=4:v=0:a=1 [outa] " -map [outv] -map [outa] -profile:v main -level 3.1 -b:v 440k -ar 48000 -ab 128k -s 720x400 -vcodec h264 -acodec libvo_aacenc test.mp4”
ffmpeg with 2 input files(usage of -i twice): ffmpeg hangs till i close server instance and once i close server, works fine
Other command(works fine):
"ffmpeg -y -i in.mp4 -filter_complex “[0] trim=start=40:end=70:duration=30, setpts=PTS-STARTPTS, scale=512:288 [v2] ;[0] trim=start=60:end=80:duration=20, setpts=PTS-STARTPTS, scale=512:288 [v1] ; movie=in2.mp4, trim=start=0:end=30:duration=30, setpts=PTS-STARTPTS, scale=512:288 [v4] ; movie=in2.mp4, trim=start=20:end=40:duration=20, setpts=PTS-STARTPTS, scale=512:288 [v3] ; [v2][v4][v1][v3] concat=n=4:v=1:a=0 [outv]; [0] atrim=start=40:end=70:duration=30, asetpts=PTS-STARTPTS [a2] ;[0] atrim=start=60:end=80:duration=20, asetpts=PTS-STARTPTS [a1] ; amovie=in2.mp4, atrim=start=0:end=30:duration=30, asetpts=PTS-STARTPTS [a4] ; amovie=in2.mp4, atrim=start=20:end=40:duration=20, asetpts=PTS-STARTPTS [a3]; [a2][a4][a1][a3] concat=n=4:v=0:a=1 [outa] " -map [outv] -map [outa] -profile:v main -level 3.1 -b:v 440k -ar 48000 -ab 128k -s 720x400 -vcodec h264 -acodec libvo_aacenc test.mp4”
ffmpeg with 1 input file(usage of -i once. 2nd input is used with movie/amovie filter option, a work around to replace usage of -i option): ffmpeg executes normal
Both commands works fine from a simple java class with main() method(as module is java class too i expect both the commands to work on wowza module too). What difference it makes to execution if i supply ffmpeg 2 inputs(-i twice) through wowza module? Can there be any memory/cpu usage contrains on my newly created process by the instance of wowza server?
Krishna