<div dir="ltr">I have been handed a tool that analyzes frames along with its source code.  The tool uses libav.  <div><br></div><div>In some cases the video input to this tool is interlaced.   The tool operates just fine, but because my intent is not to render the video but to extract and analyze features from the video I would prefer to analyze the video in a lossless manner.  In other words, I DO NOT want to deinterlace the video.  I would rather operate on half fields.  How would I do this?<br></div><div><div><br></div><div>I don't see anything specific in the source code related to deinterlacing.</div></div><div><br></div><div><font face="monospace, monospace" size="1">  bool VideoReader::getNextFrame(AVFrame *pFrame) {<br></font></div><div><font face="monospace, monospace" size="1">    ...</font></div><div><div><font face="monospace, monospace" size="1">    while( (ret = av_read_frame(pFormatCtx, &packet)) >=0) {</font></div><div><span style="font-family:monospace,monospace;font-size:x-small">        if(packet.stream_index == videoStreamIndex) {</span><br></div><div><font face="monospace, monospace" size="1">            // Decode video frame</font></div><div><font face="monospace, monospace" size="1">            avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);</font></div><div><font face="monospace, monospace" size="1">            </font></div><div><font face="monospace, monospace" size="1">            // Did we get a video frame?</font></div><div><font face="monospace, monospace" size="1">            if(frameFinished) {</font></div><div> <font face="monospace, monospace" size="1">               // no calls to av</font></div><div><font face="monospace, monospace" size="1">                ...</font></div><div><div><font face="monospace, monospace" size="1">                av_free_packet(&packet);</font></div></div><div><font face="monospace, monospace" size="1">                return true;</font></div><div><font face="monospace, monospace" size="1">            }<br></font></div><div><font face="monospace, monospace" size="1">        }</font></div><div><font face="monospace, monospace" size="1">        </font></div><div><font face="monospace, monospace" size="1">        // Free the packet that was allocated by av_read_frame</font></div><div><font face="monospace, monospace" size="1">        av_free_packet(&packet);</font></div><div><font face="monospace, monospace" size="1">    }</font></div></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="arial, helvetica, sans-serif" size="1">It appears that the deinterlacing happens auto-magically.</font></div><div><font face="arial, helvetica, sans-serif" size="1"><br></font></div><div><font face="arial, helvetica, sans-serif" size="1">--Dave</font></div><div><font face="arial, helvetica, sans-serif" size="1"><br></font></div></div>