<div class="gmail_quote">On Tue, Sep 18, 2012 at 9:03 AM, chinos <span dir="ltr"><<a href="mailto:chinos@microrapid.com" target="_blank">chinos@microrapid.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple">
<div style="layout-grid:15.6pt"><div><div>
<p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial">hi all,<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial">I am trying to decode TS file on android with hardware
decoder. And I use ffmpeg MPEGTS demuxer.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial">To init hardware decoder, extradata (SPS, PPS or sth.)
is needed to be set for both audio and video decoders. But I can not get
extradata of TS file by ffmpeg demuxer.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial">Does anyone know how to get extradata of TS file using
ffmpeg?</span></font></p></div></div></div></div></blockquote><div><br></div><div><font face="courier new, monospace">// open the file...</font></div><div><font face="courier new, monospace">if (avformat_open_input(&pFormatCtx, filename, NULL, NULL) != 0)<br>
return -1; // Couldn't open file<br>
<br>// Retrieve stream information<br>if (avformat_find_stream_info(pFormatCtx, &codec_opts) < 0)<br> return -1; // Couldn't find stream information<br><br></font></div><div><font face="courier new, monospace">// Loop over the streams</font></div>
<div><font face="courier new, monospace">for(i=0; i<pFormatCtx->nb_streams; i++)<br>
{</font></div><div><font face="courier new, monospace"> int size = pFormatCtx->streams[i]->codec->extradata_size; // HERE IS THE SIZE YOU WANT!</font></div><div><font face="courier new, monospace"> // pFormatCtx->streams[i]->codec->extradata // HERE IS WHAT YOU WANT! put this into the decoder...</font></div>
<div><font face="courier new, monospace"><br></font></div>
<div><font face="courier new, monospace"> // let's print it for debug...<br> for (int j = 0; j < size; j++ )<br> {<br> char * p = (char*)(pFormatCtx->streams[i]->codec->extradata + j);<br>
printf( "%02X", (unsigned char)*p );<br> }<br>}</font></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple"><div style="layout-grid:15.6pt"><div><div><p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial"><u></u><u></u></span></font></p>
</div></div><p class="MsoNormal"><font size="1" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial">Any help is appreciate.<u></u><u></u></span></font></p>
</div>
</div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br>