<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Gabriola;
        panose-1:4 4 6 5 5 16 2 2 13 2;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</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="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have been trying to decode videos where I need to offset start position.<o:p></o:p></p>
<p class="MsoNormal">I have tried to use AV_seek_frame but it works on raw video format (.y4m) but fails on mpeg2 compressed formats.
<o:p></o:p></p>
<p class="MsoNormal">Generally videos are in mp4 or wmv and I need to write for those directly instead of converting them into .y4m<o:p></o:p></p>
<p class="MsoNormal">Here how I’m using it <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" style="margin-left:2.75pt;border-collapse:collapse;border:none">
<tbody>
<tr style="height:136.5pt">
<td width="703" valign="top" style="width:613.75pt;border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt;height:136.5pt">
<p class="MsoNormal">//When using with time<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">double</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> t = 5;</span><span style="font-size:9.5pt;font-family:Consolas;color:green">//time in seconds</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">int64_t</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> timestamp = t *
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">AV_TIME_BASE</span><span style="font-size:9.5pt;font-family:Consolas;color:black">;
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">//destination time</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">AVRational</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> r = av_make_q(1,
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">AV_TIME_BASE</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);     
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">if</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> (VideoStreamIndex >= 0) {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">              timestamp = av_rescale_q(timestamp, r,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">                     fmt_ctx->streams[VideoStreamIndex]->time_base);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">       }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">       av_seek_frame(fmt_ctx, VideoStreamIndex, timestamp,
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">AVSEEK_FLAG_ANY</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);</span><o:p></o:p></p>
<p class="MsoNormal">or<o:p></o:p></p>
<p class="MsoNormal">if I know the frame no<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> frmaeno = 100;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">int64_t</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> point = (</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">int64_t</span><span style="font-size:9.5pt;font-family:Consolas;color:black">(frameno)
 * pavStream->r_frame_rate.den *  pavStream->time_base.den) / (</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">int64_t</span><span style="font-size:9.5pt;font-family:Consolas;color:black">(pavStream->r_frame_rate.num) *pavStream->time_base.num);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">av_seek_frame(fmt_ctx, VideoStreamIndex, point, 0);</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Tried with <span style="font-size:9.5pt;font-family:Consolas;color:black">
avformat_seek_file api too but still failing.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black">Need help here.</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="line-height:115%"><span style="font-size:14.0pt;line-height:115%;font-family:Gabriola;color:#595959">Thanks & Warm Regards,</span><b><span style="font-size:14.0pt;line-height:115%;font-family:Gabriola"><o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span style="font-size:14.0pt;font-family:Gabriola">Ganesh MUNDHE<o:p></o:p></span></b></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="0" style="width:400.9pt">
<tbody>
<tr style="height:4.5pt">
<td colspan="4" style="padding:0in 0in 0in 0in;height:4.5pt">
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</td>
</tr>
<tr style="height:16.35pt">
<td colspan="4" style="padding:0in 0in 0in 0in;height:16.35pt">
<p class="MsoNormal" style="line-height:105%"><span lang="EN-IN" style="font-size:12.0pt;line-height:105%;font-family:"Times New Roman",serif;color:#1F497D;mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
</td>
</tr>
<tr style="height:4.5pt">
<td colspan="4" style="padding:0in 0in 0in 0in;height:4.5pt">
<p class="MsoNormal"><span lang="EN-IN" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#1F497D;mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
</td>
</tr>
<tr style="height:25.45pt">
<td width="222" style="width:166.35pt;padding:0in 0in 0in 0in;height:25.45pt">
<p class="MsoNormal" style="line-height:105%"><o:p> </o:p></p>
</td>
<td width="32" rowspan="2" style="width:24.35pt;padding:0in 0in 0in 0in;height:25.45pt">
<p class="MsoNormal"><o:p> </o:p></p>
</td>
<td width="248" rowspan="2" valign="top" style="width:185.85pt;padding:0in 0in 0in 0in;height:25.45pt">
<p class="MsoNormal" style="line-height:105%"><span lang="EN-IN" style="font-size:12.0pt;line-height:105%;font-family:"Times New Roman",serif;color:#1F497D;mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
</td>
<td width="32" rowspan="2" style="width:24.35pt;padding:0in 0in 0in 0in;height:25.45pt">
<p class="MsoNormal"><span lang="EN-IN" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#1F497D;mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
</td>
</tr>
<tr style="height:19.05pt">
<td width="222" style="width:166.35pt;padding:0in 0in 0in 0in;height:19.05pt">
<p class="MsoNormal" style="line-height:105%"><span lang="EN-IN" style="mso-fareast-language:EN-IN"><o:p> </o:p></span></p>
</td>
</tr>
<tr style="height:7.25pt">
<td colspan="4" valign="top" style="padding:0in 0in 0in 0in;height:7.25pt">
<p class="MsoNormal" style="line-height:105%"><i><o:p> </o:p></i></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged.</p>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
If you are not one of the named recipients or have received this email in error, </p>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
(i) you should not read, disclose, or copy it,</p>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
(ii) please notify sender of your receipt by reply email and delete this email and all attachments,</p>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
(iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.</p>
<p style="FONT-STYLE: italic; MARGIN: 0px 0px 0px 35.4pt; FONT-FAMILY: Arial, Helvetica, sans-serif; COLOR: #9d9d9d; FONT-SIZE: 9pt">
</p>
<p style="FONT-SIZE: 9pt; MARGIN: 0px 0px 0px 35.4pt; COLOR: #9d9d9d; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif">
For other languages, go to http://www.3ds.com/terms/email-disclaimer </p>
</body>
</html>