无法使用 FFMPEG Java 打开 RTMP 流无法分配请求的地址

问题描述 投票:0回答:1

我正在尝试使用

avformat_open_input
打开 RTMP 流,但由于某种原因,我不断收到
Cannot assign requested address
错误。
我的 RTMP URL 是正确的,因为我可以使用 VLC Player 和 ffmpeg 命令行观看流:
ffmpeg -i rtmp://1.1.1.1/app/teststream -vcodec copy -acodec copy output.mp4

int timeout = 2500;
setConnectionTimeout(timeout);

AVDictionary optionsDictionary = new AVDictionary();

String timeoutStr = String.valueOf(this.timeoutMicroSeconds);
av_dict_set(optionsDictionary, "timeout", timeoutStr, 0);

int analyzeDurationUs = 1500 * 1000;
String analyzeDuration = String.valueOf(analyzeDurationUs);
av_dict_set(optionsDictionary, "analyzeduration", analyzeDuration, 0);

int ret;

if ((ret = avformat_open_input(inputFormatContext, streamUrl, null, optionsDictionary)) < 0) {
  // ERROR Cannot assign requested address
}

我正在使用

org.bytedeco:ffmpeg:5.1.2-1.5.8 (ffmpeg-5.1.2-1.5.8.jar)

为什么打不开?

java ffmpeg rtmp bytedeco-javacv
1个回答
0
投票

如果是 rtmp,只需将 null 作为 optionsDictionary 传递。 ffmpeg 向后比较不是最好的

© www.soinside.com 2019 - 2024. All rights reserved.