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

**URL:** <https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664>\
**Category:** Wowza Streaming Engine\
**Created:** [January 28, 2018, 6:04am UTC](https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664 "2018-01-28T06:04:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![atulesh\_more](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@atulesh\_more](https://community.wowza.com/u/atulesh_more)\
**Post date:** [January 28, 2018, 6:04am UTC](https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664/1 "2018-01-28T06:04:47Z")

</div>

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](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](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](https://pb.environment)().put(“LD\_LIBRARY\_PATH”,"/usr/lib/:/usr/bin/ffmpeg:/usr/bin/ffprobe:/usr/bin/ffserver:/usr/bin/ffplay");  
[//pb.environment](https://pb.environment)().put(“LD\_LIBRARY\_PATH”,"/usr/local/lib:/usr/lib:/lib:/usr/local/bin/ffmpeg:/usr/local/bin/ffprobe");  
[//pb.environment](https://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());

}

}

---

<div class="post-metadata">

**Author:** ![Jay\_Charles1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/jay_charles1/32/514_2.png) [@Jay\_Charles1](https://community.wowza.com/u/Jay_Charles1)\
**Post date:** [January 28, 2018, 4:36pm UTC](https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664/2 "2018-01-28T16:36:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![atulesh\_more](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@atulesh\_more](https://community.wowza.com/u/atulesh_more)\
**Post date:** [January 29, 2018, 4:50pm UTC](https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664/3 "2018-01-29T16:50:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![atulesh\_more](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@atulesh\_more](https://community.wowza.com/u/atulesh_more)\
**Post date:** [January 29, 2018, 4:50pm UTC](https://community.wowza.com/t/ffmpeg-command-not-working-in-wowza-module-when-running-on-ubuntu/50664/4 "2018-01-29T16:50:32Z")

</div>

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.
