我正在尝试使用
avformat_open_input
打开 RTMP 流,但由于某种原因,我不断收到 Cannot assign requested address
错误。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)
为什么打不开?
如果是 rtmp,只需将 null 作为 optionsDictionary 传递。 ffmpeg 向后比较不是最好的