Wowza Community

FFMPEG command not working in wowza module when running on Ubuntu.

Hi
Please check this ffmpeg code snippet ( at bottom). This is simple function snapOperation() and this function supposed to take snaps from live stream. The problem is ffmpeg command is not working on my Ubuntu 16 box.
Same code is working on Window. If I fire ffmpeg command on ubuntu console it generate output ( /home/snaps/ff.jpg).
I used same code in Red5Pro and its not working.

Please check this
https://stackoverflow.com/questions/22909434/read-rtmp-live-streaming-vido-data-using-java-code I followed instrcutions from this link.
Also I posted this problem on stackoverflow here https://stackoverflow.com/questions/48391956/ffmpeg-rtmp-not-working-in-my-red5pro-module-on-ubuntu-14-0-4/48424670?noredirect=1#comment83840226_48424670

public void snapOperation()
{

try
{
//here stream name is mytest and generating snap name is ff.jpg
String[] execStr = {"/usr/bin/ffmpeg", “-i”, “rtmp://127.0.0.1:1935/live/mytest”, “live=1”, “timeout=2”, “-f”, “image2”, “-vframes”, “1”, “/home/snaps/ff.jpg”};
//String[] execStr = {"/usr/bin/ffmpeg", “-i”, ““rtmp://127.0.0.1:1935/live/mytest live=1 timeout=2"”, “-f”, “image2”, “-vframes”, “1”, “/home/snaps/ff.jpg”};
//String[] execStr = {”/usr/bin/ffmpeg", “-i”, "“rtmp://127.0.0.1:1935/live/mytest?live=1&timeout=2"”, “-f”, “image2”, “-vframes”, “1”, “/home/snaps/ff.jpg”};

ProcessBuilder pb = new ProcessBuilder(execStr);
//pb.environment().put(“LD_LIBRARY_PATH”,"/usr/lib/:/usr/bin/ffmpeg:/usr/bin/ffprobe:/usr/bin/ffserver:/usr/bin/ffplay");
//pb.environment().put(“LD_LIBRARY_PATH”,"/usr/local/lib:/usr/lib:/lib:/usr/local/bin/ffmpeg:/usr/local/bin/ffprobe");
//pb.environment().put(“PATH”,"/usr/local/lib:/usr/lib:/lib");

pb.redirectErrorStream(true);
Process p = pb.start();
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line2 = null;
while ((line2 = in.readLine()) != null)
{
System.out.println(“OUTPUT--------------->”+line2);
}
if (p.waitFor() == 0)
{

}
}
catch (Exception e)
{
// TODO Auto-generated catch block
System.out.println("----------Exception is---------- :"+e.toString());

}

}

Try using “/usr/bin/./ffmpeg” or (if ffmpeg is on your path), just “ffmpeg” as your exec argument.

Thanks for your reply but please remember ffmpeg command works in both case ffmpeg or /usr/bin/ffmpeg.

I mentioned that if I run command to take snap from vod.mp4 file then it will work in java processbuilder.

I am not sure but I think issue is with rtmp://… live=1 timeout=2 stuff.

FFMPEG is on my path. Also please remember if I run FFMPEG command of taking snaps from static mp4 file then it will work in java processbuilder function.

Only this stuff “rtmp:// live=1 timeout=2” is not working.