bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.41k stars 1.57k forks source link

Cannot Open RTMP Stream Cannot assign requested address #2092

Closed lastpeony closed 10 months ago

lastpeony commented 10 months ago

I am trying to open an RTMP stream with avformat_open_input for some reason i keep geting 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)

lastpeony commented 10 months ago

just pass null as optionsDictionary. ffmpeg backwards comp is not the best