<div dir="ltr"><div dir="ltr"><div dir="ltr">I have multiple input devices (Cameras), every one of them is encoded to their own file. Everything is working fine. I have only one input AVFormatContext. This is how cameras are opened<div><br></div><div><div>for (int i = 0; i < CameraList.Count; i++)</div><div>            {</div><div>                var camera = CameraList[i];</div><div>                    AVDictionary* optionalOpts;</div><div>                    if (!string.IsNullOrEmpty(camera.InputResolution))</div><div>                        ffmpeg.av_dict_set(&optionalOpts, "video_size", camera.InputResolution, 0);</div><div><br></div><div>                    ffmpeg.av_dict_copy(&optionalOpts, options, 0);</div><div><br></div><div>                    AVInputFormat* inputFormat = null;</div><div><br></div><div>                    if (!string.IsNullOrEmpty(camera.Format))</div><div>                    {</div><div>                        inputFormat = ffmpeg.av_find_input_format(camera.Format);</div><div>                        if (inputFormat == null)</div><div>                            // exception</div><div>                    }</div><div><br></div><div>                    if (ffmpeg.avformat_open_input(&pInputFmtCtx, camera.Url, inputFormat, &optionalOpts) != 0)</div><div>                    {</div><div>                        if (ffmpeg.avformat_open_input(&pInputFmtCtx, camera.Url, inputFormat, &options) != 0)</div><div>                            // exception</div><div>                    }</div><div>            }</div></div><div><br></div><div>The problem is that the application crashes when having more than one input, specifically here:</div><div><br></div><div><div>fixed (AVFormatContext** p = &InputFormatContext)</div><div>                    ffmpeg.avformat_close_input(p);</div></div><div><br></div><div>If I have single input (one video and one audio stream) everything is fine. There is no errors thrown, just crash and that's it.What am I doing wrong?</div></div></div></div>