<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texte de bulles Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.TextedebullesCar
        {mso-style-name:"Texte de bulles Car";
        mso-style-priority:99;
        mso-style-link:"Texte de bulles";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hello,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I use the last released FFMPEG library to decode H264 video streams (each frame send to the avcodec_decode_video2 function is a full video frame).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>When I look several code sources samples, it seems that everyone set differents options for the CodecContext and the Codec flags.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I someone can tell me if I use the better ones to decode H264 :<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->skip_frame       =  AVDISCARD_NONREF;<span style='color:green'><o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->skip_loop_filter =  AVDISCARD_ALL;<span style='color:green'><o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->skip_idct        =  AVDISCARD_ALL;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->idct_algo        =  1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->has_b_frames     =  0;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->refs             =  1;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>av_opt_set(m_lpCodecCtx->priv_data, <span style='color:red'>"preset"</span>, <span style='color:red'>"ultrafast"</span>, 0);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>av_opt_set(m_lpCodecCtx->priv_data, <span style='color:red'>"tune"</span>, <span style='color:red'>"zerolatency"</span>, 0);<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I also set the codec flags like this :<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>if</span><span style='font-size:10.0pt;font-family:"Courier New"'>(m_lpCodec->capabilities&CODEC_CAP_TRUNCATED) <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> m_lpCodecCtx->flags|= CODEC_FLAG_TRUNCATED;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:green'>// Enable faster H264 decode.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodec->capabilities |= CODEC_CAP_FRAME_THREADS;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->flags     |= CODEC_FLAG_LOW_DELAY;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>m_lpCodecCtx->flags2    |= CODEC_FLAG2_FAST;</span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Regards,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b><span style='font-family:"Arial","sans-serif";color:#003399'>Jérôme SALAYET</span></b><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:black'>Ingénieur Informatique</span></b><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'>Tél :    04 67 87 61 12</span></b><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'>Fax :   04 67 70 85 44</span></b><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'>Site web : </span></b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'><a href="http://www.hymatom.fr/"><span style='color:blue'>www.hymatom.fr</span></a></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'>Email : </span></b><span style='font-size:9.0pt;font-family:"Arial","sans-serif";color:gray'><a href="mailto:jerome.salayet@hymatom.fr"><span style='color:blue'>jerome.salayet@hymatom.fr</span></a></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br></span><span style='font-size:5.0pt;font-family:"Arial","sans-serif"'><br></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img border=0 width=329 height=68 id="_x0000_i1025" src="cid:image001.png@01CE102E.8F464450" alt=" "></span><o:p></o:p></p></div></body></html>