2017-08-07 40 views
2

我正在使用ffmpeg讀取rtsp相機。 「在C++和‘服務器響應非匹配運輸中發現無效數據處理輸入’相機已設置。‘RTP ES’時,下面的代碼ffmpeg rtsp錯誤:服務器應答中的非匹配傳輸

source_name = "rtsp://192.168.1.108/WESCAM"; 

// Open the initial context variables that are needed 
format_ctx = avformat_alloc_context();  
codec_ctx = NULL; 

// Register everything 
av_register_all(); 
avformat_network_init(); 

//open RTSP camera or h264 file 
if (avformat_open_input(&format_ctx, source_name, NULL, NULL) != 0) 
{ 
    return EXIT_FAILURE; 
} 
+0

我可以使用上面顯示的RTSP地址,我使用的是RedHat 6.9玩這個VLC – Douglas

回答

0

可:我發現了一個錯誤:ffmpeg的rtsp的錯誤。這是很有幫助的:

AVDictionary *opts = nullptr; 
av_dict_set(&opts, "rtsp_transport", "udp", 0); // here "udp" can replaced by "tcp" 
avformat_open_input(&pFormatCtx, rtsp_addr, nullptr, &opts); 
... 
av_dict_free(&opts); 
+0

請給多一點信息,像它做什麼,以及它是如何解決的OP問題 – RealCheeseLord

+0

感謝。 - 我已經試過了,但它仍然無法正常工作,但卻得到了不同的錯誤。 「找不到編解碼器參數數據流0(視頻:h264,無):未指定的大小: 考慮增加「分析」和「探測大小」選項的值「 當我發出命令 codec_ctx = avcodec_alloc_context3(codec); avcodec_get_context_defaults3(codec_ctx,codec); avcodec_parameters_to_context(codec_ctx,format_ctx-> streams [video_stream_index] - > codecpar); 流的寬度和高度爲0 我正在使用VITEC MGW NANO編碼器 – Douglas