<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I have some code that worked without issue up until now. When I pass a file path into <span style="caret-color: rgb(38, 71, 75); color: rgb(38, 71, 75); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">avformat_open_input</span>  I can create a pFormatCtx, but none of the streams have any codec information associated with them, ie <span style="caret-color: rgb(63, 110, 116); color: rgb(63, 110, 116); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">pFormatCtx</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">-></span><span style="caret-color: rgb(63, 110, 116); color: rgb(63, 110, 116); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">streams</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">[</span><span style="caret-color: rgb(63, 110, 116); color: rgb(63, 110, 116); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">i</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">]-></span><span style="caret-color: rgb(63, 110, 116); color: rgb(63, 110, 116); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">codecpar </span>is null. I assume that my codecs are not being opened? I know that av_register_all() is deprecated, but otherwise avformat_open_input doesn’t work. I am using 3.4.2 of ffmpeg. Any assistance is appreciated.<div class=""><br class=""></div><div class="">Patrick<br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(38, 71, 75); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span>av_register_all<span style="color: #000000" class="">();</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #aa0d91" class="">int</span> error = <span style="color: #26474b" class="">avformat_open_input</span>(&<span style="color: #3f6e74" class="">pFormatCtx</span>, filePath, <span style="color: #aa0d91" class="">NULL</span>, <span style="color: #aa0d91" class="">NULL</span>);</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #aa0d91" class="">if</span>(error != <span style="color: #1c00cf" class="">0</span>){</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #aa0d91" class="">char</span> * errorString= (<span style="color: #aa0d91" class="">char</span>*)<span style="color: #2e0d6e" class="">malloc</span>(<span style="color: #643820" class="">AV_ERROR_MAX_STRING_SIZE</span>);</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        (<span style="color: #aa0d91" class="">void</span>) <span style="color: #26474b" class="">av_strerror</span>(error, errorString, <span style="color: #643820" class="">AV_ERROR_MAX_STRING_SIZE</span>);</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #2e0d6e" class="">printf</span>(<span style="color: #c41a16" class="">"%s\n"</span>, errorString);</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 116, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3f6e74" class="">status</span><span style="color: #000000" class=""> = </span><span style="color: #26474b" class="">K_CANT_OPEN_FILE</span><span style="color: #000000" class="">; </span>// Couldn't open file</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #aa0d91" class="">return</span>;</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><p style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class="">    <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(38, 71, 75); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #aa0d91" class="">if</span><span style="color: #000000" class="">(</span>avformat_find_stream_info<span style="color: #000000" class="">(</span><span style="color: #3f6e74" class="">pFormatCtx</span><span style="color: #000000" class="">, </span><span style="color: #aa0d91" class="">NULL</span><span style="color: #000000" class="">)<</span><span style="color: #1c00cf" class="">0</span><span style="color: #000000" class="">){</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(38, 71, 75); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">       </span><span style="color: #3f6e74" class="">status</span><span style="color: #000000" class=""> = </span>K_NO_STREAM_INFO<span style="color: #000000" class="">;  </span><span style="color: #007400" class="">//NO STREAM INFO</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #aa0d91" class="">return</span>;</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(63, 110, 116); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span>videoStream<span style="color: #000000" class=""> = -</span><span style="color: #1c00cf" class="">1</span><span style="color: #000000" class="">;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(63, 110, 116); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #aa0d91" class="">for</span><span style="color: #000000" class="">(</span>i<span style="color: #000000" class=""> = </span><span style="color: #1c00cf" class="">0</span><span style="color: #000000" class="">; </span>i<span style="color: #000000" class=""> < </span>pFormatCtx<span style="color: #000000" class="">-></span>nb_streams<span style="color: #000000" class="">; </span>i<span style="color: #000000" class="">++){</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(63, 110, 116); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span>AVStream<span style="color: #000000" class=""> * stream = </span>pFormatCtx<span style="color: #000000" class="">-></span>streams<span style="color: #000000" class="">[</span>i<span style="color: #000000" class="">];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">        </span><span style="color: rgb(170, 13, 145); font-family: Menlo; font-size: 11px;" class="">if</span><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">(</span><font color="#3f6e74" face="Menlo" class=""><span style="font-size: 11px;" class="">pFormatCtx</span></font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">-></span><font color="#3f6e74" face="Menlo" class=""><span style="font-size: 11px;" class="">streams</span></font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">[</span><font color="#3f6e74" face="Menlo" class=""><span style="font-size: 11px;" class="">i</span></font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">]-></span><font color="#3f6e74" face="Menlo" class=""><span style="font-size: 11px;" class="">codecpar</span></font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class="">-></span><font color="#3f6e74" face="Menlo" class=""><span style="font-size: 11px;" class="">codec_type</span></font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 11px;" class=""> == </span><span style="color: rgb(38, 71, 75); font-family: Menlo; font-size: 11px;" class="">AVMEDIA_TYPE_VIDEO</span><font face="Menlo" class=""><span style="font-size: 11px;" class="">) {. // <—codecpar is NULL</span></font></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #3f6e74" class="">videoStream</span>=<span style="color: #3f6e74" class="">i</span>;</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #aa0d91" class="">break</span>;</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div></div></div></body></html>