I want to receive video stream from camera, process it using openCV (for tests - draw red rectangle) and live stream result.
I already can read camera frames, convert to openCV Mat and change them back to AVFrame.
From console im starting rtsp server using: ffplay -rtsp_flags listen -i rtsp://127.0.0.1:8765/live.sdp Problem shows when im trying call avio_open();
av_register_all();
avformat_network_init();
avcodec_register_all();
(...)
avformat_alloc_output_context2(&outputContext, NULL, "rtsp", outputPath.c_str());
outputFormat = outputContext->oformat;
cout << "Codec = " << avcodec_get_name(outputFormat->video_codec) << endl;
if (outputFormat->video_codec != AV_CODEC_ID_NONE) {
videoStream = add_stream(outputContext, &outputVideoCodec, outputFormat->video_codec);
}
char errorBuff[80];
int k = avio_open(&outputContext->pb, outputPath.c_str(), AVIO_FLAG_WRITE);
if (k < 0) {
cout << "code: " << k << endl;
fprintf(stderr, "%s n", av_make_error_string(errorBuff, 80, k));
}
if (avformat_write_header(outputContext, NULL) < 0) {
fprintf(stderr, "Error occurred when writing header");
}
}
Where outputPath = "rtsp://127.0.0.1:8765/live.sdp" avformat_alloc_output_context2 retus 0, but avio_open < 0 so app prints:
code: -1330794744
Protocol not found
I have no idea what is wrong. I am using ffmpeg build from https://ffmpeg.zeranoe.com/builds/ 64-bit Dev
