gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:25:54 30 4
gpt4 key购买 nike

以下命令在我的 java 模块中不起作用(这会从实时流中获取快照并保存)
Runtime.getRuntime().exec("ffmpeg -i\"rtmp://127.0.0.1:1935/live/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 = new ProcessBuilder("ffmpeg -i rtmp://localhost/live/mytest live=1 timeout=2 -f image2 -vframes 1/snaps/testo.jpg");

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

最佳答案

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

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);

或像这样:
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

关于FFMPEG RTMP 在 Ubuntu 14.0.4 上的 red5pro 模块中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48391956/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com