I am trying to open an RTMP stream with avformat_open_input and for some reason i keep getting Cannot assign requested address error.
My RTMP URL is correct because i can watch the stream using VLC Player and ffmpeg command line:
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
}
I am using org.bytedeco:ffmpeg:5.1.2-1.5.8 (ffmpeg-5.1.2-1.5.8.jar)
Why i can't open it?
just pass null as optionsDictionary if its rtmp. ffmpeg backwards comp is not the best