执行程序后控制台输出如下:
程序代码如下:
int main()
{
AVFormatContext *input_ctx = NULL;
int video_stream, ret;
AVStream *video = NULL;
AVCodecContext *decoder_ctx = NULL;
AVCodec *decoder = NULL;
AVPacket packet;
enum AVHWDeviceType type;
int i;
const char *name = "d3d11va";
type = av_hwdevice_find_type_by_name(name);
if (type == AV_HWDEVICE_TYPE_NONE) {
fprintf(stderr, "Device type %s is not supported.\n", name);
return -1;
}
// 打开输入文件
const char *url = "rtsp://root:vbox_12306@10.108.6.19:3097/55Ogq4fZ14875442466";
input_ctx = avformat_alloc_context();
AVDictionary* options = NULL;
av_dict_set(&options, "rtsp_transport", "tcp", 0);//采用tcp传输(默认udp)
av_dict_set(&options, "stimeout", "2000000", 0);
av_dict_set(&options, "probesize", "5000000000", 0);
av_dict_set(&options, "analyzeduration", "100000000", 0);
if (avformat_open_input(&input_ctx,url, NULL, &options) != 0) {
fprintf(stderr, "Cannot open input file '%s'\n", url);
return -1;
}
if (avformat_find_stream_info(input_ctx, NULL) < 0) {
fprintf(stderr, "Cannot find input stream information.\n");
return -1;
}
rtsp流来自服务器上的一个网络摄像头,没有声音,只有图像。
希望大神能够帮忙看一下应该如何解决啊