<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi all,<div>    I've a .mp4 file which contain h.264 video and AAC audio. I wants to extract MacroBlock and motion vector information of each frame while decoding.  Please find my below Pseudocode.</div><div><br></div><div>avformat_open_input(file_name) //opening file </div><div>avcodec_open2(pCodecContext, pCodec, NULL) // opening decoder<br></div><div>while (response >= 0) // reading each frame</div><div><div><span style="white-space:pre">   </span>{</div><div><span style="white-space:pre">             </span>response = avcodec_receive_frame(pCodecContext, pFrame);</div><div><span style="white-space:pre">              </span>if (response == AVERROR(EAGAIN) || response == AVERROR_EOF || response < 0) {</div><div><span style="white-space:pre">              </span>    break;</div><div><span style="white-space:pre">          </span>}</div><div><b><span style="white-space:pre">            </span>// extract macroblock of pFrame here</b></div><div>                av_frame_unref(pFrame);</div><div><span style="white-space:pre"> </span>}</div></div><div><br></div><div>I have seen in other post mentioned that we can get MB information through MpegEncContext structure, but i'm confused were and how to instantiate object of that structure, how the MB data of the structure gets updated for each frame.?</div><div>Ultimately, I wants to compare macroblock from one frame to other frame using SAD (sum of absolute difference) and trigger alerts if there is any distortion in macroblock level.</div><div>I would really appreciate if anyone help on this ☺.</div><div><br></div><div>Regards,</div><div>Venkateswaran.S</div><div><br></div><div><br></div></div></div></div></div></div></div></div>