<div dir="ltr"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Hello,</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">I am working on an assignment (using C++) to decode all the subtitle streams present in a m2ts file using libav.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">I have a m2ts file with one video stream (video stream index = 0), one audio stream (audio stream index = 1) and 5 subtitle streams ( stream indices = 2, 3, 4, 5).</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">I first noticed the problem when I compared the position (x, y, w, h) I got from the decoded subtitle against the actual subtitle position from its control file.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><strong style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">The details of the actual events</strong><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">SUBTITLE_STREAM_INDEX_2</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Event1 (X="607" Y="780" START_FRAME="764")</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">SUBTITLE_STREAM_INDEX_3</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Event1 (X="575" Y="780" START_FRAME="764")</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">SUBTITLE_STREAM_INDEX_4</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Event1 (X="701" Y="780" START_FRAME="764")</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">SUBTITLE_STREAM_INDEX_5</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Event1 (X="483" Y="777" START_FRAME="765")</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><strong style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><em style="margin:0px;padding:0px"><div class="" style="margin:10px 20px;padding:0px;clear:both">

<table border="0" cellspacing="0" cellpadding="0" class="" style="margin:0px;padding:0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_left_top.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="100%" class="" style="padding:0px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_top.gif);background-color:rgb(245,249,251);background-repeat:repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_right_top.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td></tr><tr style="margin:0px;padding:0px"><td class="" style="padding:0px;width:4px;overflow:hidden;background-color:rgb(245,249,251);border-left-style:solid;border-left-width:1px;border-left-color:rgb(203,221,232)">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="3" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td class="" width="100%" style="padding:0px 2px;background-color:rgb(245,249,251);background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bg_quote.gif);background-repeat:no-repeat no-repeat">

<div class="" style="margin:0px;padding:0px 0px 3px;color:rgb(41,129,180);font-size:0.85em">Quote:</div><div class="" style="margin:0px;padding:0px;font-weight:normal;font-size:1em;line-height:1.4em;color:rgb(68,68,68)">
Please note Event1 of SUBTITLE_STREAM_INDEX_2, SUBTITLE_STREAM_INDEX_3, SUBTITLE_STREAM_INDEX_4 start at frame no 764.</div>
</td><td class="" style="padding:0px;width:4px;overflow:hidden;background-color:rgb(245,249,251);border-right-style:solid;border-right-width:1px;border-right-color:rgb(203,221,232)"><img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="3" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td>

</tr><tr style="margin:0px;padding:0px"><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_left_bot.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="100%" class="" style="padding:0px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_bot.gif);background-color:rgb(245,249,251);background-repeat:repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_right_bot.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td></tr></tbody></table></div></em></strong><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">When I ran the application, it first decoded Event1 of SUBTITLE_STREAM_INDEX_4 and I got the position values from the decoded subtitle as (701, 780, 507, 133).</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Next it decoded Event1 of SUBTITLE_STREAM_INDEX_2 and the position values decoded were as follows (701, 780, 507, 133). Please note the mismatch in values.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">The values were same for decoded subtitle of SUBTITLE_STREAM_INDEX_3.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">AS the next step I am decoding the subtitle and generating a png file. This is when I noticed the issue.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">For example I am decoding SUBTITLE_STREAM_INDEX_4 at frame no = 764. I generated the image using the subtitle->rects[0]->pict.data. This is correct subtitle. (Assume the dialog to be "hi there").</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Now I have another subtitle stream (index = 2) which also starts from the same frame number (frame no = 764). Now when I generate a png using this decoded subtitle it has the same subtitle text as the one decoded from previous index. (the actual dialog is "hola", but the png generated had the dialog as "hi there").</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">It is basically giving me the position and data of the subtitle decoded from the first SUBTITLE_STREAM encountered for a particular frame number.</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">I am posting the part of code:</span><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><div class="" style="margin:10px 20px;padding:0px;clear:both;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<table border="0" cellspacing="0" cellpadding="0" class="" width="100%" style="margin:0px;padding:0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_left_top.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="100%" class="" style="padding:0px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_top.gif);background-color:rgb(245,249,251);background-repeat:repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_right_top.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td></tr><tr style="margin:0px;padding:0px"><td class="" style="padding:0px;width:4px;overflow:hidden;background-color:rgb(245,249,251);border-left-style:solid;border-left-width:1px;border-left-color:rgb(203,221,232)">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="3" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td class="" width="100%" style="padding:0px 2px;background-color:rgb(245,249,251);background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bg_code.gif);background-repeat:no-repeat no-repeat">

<div class="" style="margin:0px;padding:0px 0px 3px;color:rgb(41,129,180);font-size:0.85em;font-weight:bold"><b style="margin:0px;padding:0px">Code:</b></div><div class="" style="margin:0px;padding:0px;direction:ltr;font-size:11px;font-family:Monaco,'Courier New',monospace;color:rgb(68,68,68);overflow:auto">

AVPacket packet;   <br style="margin:0px;padding:0px">//looping till end of file<br style="margin:0px;padding:0px">{   <br style="margin:0px;padding:0px">   av_init_packet(&packet);<br style="margin:0px;padding:0px">
    av_read_frame(pFormatContext, &packet);<br style="margin:0px;padding:0px">
   <br style="margin:0px;padding:0px">if((packet.stream_index == m_subtitleStreamIndex[0]) || (packet.stream_index == m_subtitleStreamIndex[1]) || (packet.stream_index == m_subtitleStreamIndex[2]) || (packet.stream_index == m_subtitleStreamIndex[3]))<br style="margin:0px;padding:0px">

{<br style="margin:0px;padding:0px">   int has_subtitle = 0;<br style="margin:0px;padding:0px">    AVSubtitle* subtitle = new AVSubtitle;<br style="margin:0px;padding:0px">    avcodec_decode_subtitle2(pSubtitleCodecContext, subtitle, &has_subtitle, &packet);<br style="margin:0px;padding:0px">

<br style="margin:0px;padding:0px">    if (has_subtitle != 0)<br style="margin:0px;padding:0px">    {    <br style="margin:0px;padding:0px">        if (subtitle->rects)<br style="margin:0px;padding:0px">            {<br style="margin:0px;padding:0px">

                struct SwsContext *mSwsContext = sws_getContext(subtitle->rects[0]->w, subtitle->rects[0]->h, pSubtitleCodecContext->pix_fmt,<br style="margin:0px;padding:0px">                                        subtitle->rects[0]->w, subtitle->rects[0]->h, PIX_FMT_RGBA,<br style="margin:0px;padding:0px">

                                        SWS_BICUBIC, NULL, NULL, NULL);<br style="margin:0px;padding:0px">                AVFrame     *pPicture = AllocatePicture(PIX_FMT_RGBA, subtitle->rects[0]->w, subtitle->rects[0]->h);<br style="margin:0px;padding:0px">

<br style="margin:0px;padding:0px">                /* convert to RGB */<br style="margin:0px;padding:0px">                sws_scale(mSwsContext, (const uint8_t **) subtitle->rects[0]->pict.data, subtitle->rects[0]->pict.linesize, 0, subtitle->rects[0]->h,<br style="margin:0px;padding:0px">

                                        pPicture->data, pPicture->linesize);<br style="margin:0px;padding:0px">                                       <br style="margin:0px;padding:0px">                //code to generate png<br style="margin:0px;padding:0px">

                                               <br style="margin:0px;padding:0px">                av_free(pPicture);<br style="margin:0px;padding:0px">                sws_freeContext(mSwsContext);<br style="margin:0px;padding:0px">

            }<br style="margin:0px;padding:0px">        }<br style="margin:0px;padding:0px">   }<br style="margin:0px;padding:0px">    avsubtitle_free(subtitle);<br style="margin:0px;padding:0px">}   <br style="margin:0px;padding:0px">

}</div></td><td class="" style="padding:0px;width:4px;overflow:hidden;background-color:rgb(245,249,251);border-right-style:solid;border-right-width:1px;border-right-color:rgb(203,221,232)"><img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="3" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td>

</tr><tr style="margin:0px;padding:0px"><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_left_bot.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="100%" class="" style="padding:0px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_bot.gif);background-color:rgb(245,249,251);background-repeat:repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td><td width="4" height="4" class="" style="padding:0px;width:4px;height:4px;overflow:hidden;background-image:url(http://ffmpeg.zeranoe.com/forum/styles/hestia_blue/theme/images/bb_right_bot.gif);background-repeat:no-repeat no-repeat">

<img src="http://ffmpeg.zeranoe.com/forum/images/spacer.gif" width="4" height="4" border="0" alt="" style="margin: 0px; padding: 0px; border: none;"></td></tr></tbody></table></div><br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">

<br style="margin:0px;padding:0px;color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Could anyone please advice if I am doing something wrong here or suggest a solution to this problem? I am expecting your priceless guidance and help.</span><br>

<div><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)"><br></span></div><div style><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Thanks,</span></div>

<div style><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Helvetica,Arial,sans-serif;font-size:12px;line-height:16.78333282470703px;background-color:rgb(235,244,248)">Srijith</span></div></div>