首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FFMPEG RTMP在Ubuntu 14.0.4上的red5pro模块中不起作用

FFMPEG RTMP在Ubuntu 14.0.4上的red5pro模块中不起作用
EN

Stack Overflow用户
提问于 2018-01-23 07:35:49
回答 1查看 256关注 0票数 0

以下命令在我的java模块中不起作用(这是从直播流中截取快照并保存) Runtime.getRuntime().exec("ffmpeg -i \“rtmp://127.0.0.1:1935/Runtime.getRuntime/mytest live=1 timeout=2\”-f image2 -vframes 1 /snaps/testo.jpg");

如果我在Ubuntu 14.0.4控制台上使用相同的命令,它可以工作。同样的命令在Window上的red5pro模块中也有效,但在Ubuntu上不起作用。

当我使用String[] execStr = {"/usr/local/bin/ffmpeg"," -i ","rtmp://127.0.0.1:1935/live/mytest"," live=1 "," timeout=2 "," -f "," image2 "," -vframes ","1","/snaps/tt.jpg"};ProcessBuilder pb =新ProcessBuilder("ffmpeg -i rtmp://localhost/live/mytest live=1 timeout=2-f image2-vframes 1/snaps/TT.jpg“);

它总是抛出找不到流(在red5pro控制台中)

EN

回答 1

Stack Overflow用户

发布于 2018-01-24 22:19:48

我不懂Java (除了一点,我对FFmpeg很有经验),但我认为你应该像这样写代码:

代码语言:javascript
复制
String[] execStr = {"/usr/local/bin/ffmpeg", "-i", "rtmp://127.0.0.1:1935/live/mytest", "live=1", "timeout=2", "-f", "image2", "-vframes", "1", "/snaps/tt.jpg"};
ProcessBuilder pb = new ProcessBuilder(execStr);

或者像这样:

代码语言:javascript
复制
String[] execStr = {"/usr/local/bin/ffmpeg", "-i", "\"rtmp://127.0.0.1:1935/live/mytest live=1 timeout=2\"", "-f", "image2", "-vframes", "1", "/snaps/tt.jpg"};
ProcessBuilder pb = new ProcessBuilder(execStr);

我在这里查看:https://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48391956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档