FFmpeg: Live streaming using RSTP C++ -
i want receive video stream camera, process using opencv (for tests - draw red rectangle) , live stream result.
i can read camera frames, convert opencv mat , change them 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 returns 0, avio_open < 0 app prints:
code: -1330794744
protocol not found
i have no idea wrong. using ffmpeg build https://ffmpeg.zeranoe.com/builds/ 64-bit dev
enable file protocol doing:
--enable-protocol=file
Comments
Post a Comment