<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=utf-8">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",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.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@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="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="FR" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">After many try to change resolution of my output video file, I failed.. I didn’t understand how to use the function sws_scale() with
AVPacket where is my stream video.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Could you help me please ?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">This is my source code :<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><stdio.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><stdlib.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><string.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><unistd.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><iostream></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><fstream></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><sstream></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">extern</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"C"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><libavcodec/avcodec.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><libavformat/avformat.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><libavformat/avio.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178"><libswscale/swscale.h></span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">}<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">main</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
argc, </span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">char</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">** argv) {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Open the initial context variables that are needed</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVFormatContext* ifcx =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVCodecContext* cctx =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVStream * ivst =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> i_vindex;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> got_key_frame =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVFormatContext * ofcx;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVOutputFormat * ofmt;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVStream * ovst =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, * oast =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVPacket pkt;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ix;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">struct</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#4EC9B0">SwsContext</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> *resize;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// pts computing</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> AVRational vPtsFactor, aPtsFactor = {
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> } ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Register everything</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// av_register_all();</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// avformat_network_init();</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"1</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">//open http</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_open_input</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(&ifcx,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"http://192.9.200.121/ipcam/mjpeg.cgi"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) !=
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">return</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> EXIT_FAILURE;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_find_stream_info</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(ifcx,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) <
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">return</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> EXIT_FAILURE;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"2</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">//search video stream</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> i_vindex = -</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">for</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (ix =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">; ix < (</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">)
ifcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">nb_streams</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">; ix++) {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Get the codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> cctx = ifcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">streams</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">[
ix ]-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec_type</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
== AVMEDIA_TYPE_VIDEO)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst = ifcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">streams</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">[
ix ];<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> i_vindex = ix;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">continue</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
( i_vindex < </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> )<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"KNC230ERROR: Cannot find input video stream</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_close_input</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
&ifcx );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"3</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">//open output file -------------------------------------------</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ofmt =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_guess_format</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"/home/Nexeya/capture6.mkv"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ofcx =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_alloc_context</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">();<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ofcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">oformat</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= ofmt;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avio_open2</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
&ofcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pb</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"/home/Nexeya/capture6.mkv"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, AVIO_FLAG_WRITE,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"4</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Create video output stream -------------------------------------------</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">//ovst = avformat_new_stream( ofcx, (AVCodec
*) cctx->codec );</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_new_stream</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">( ofcx,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avcodec_copy_context</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, cctx);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">sample_aspect_ratio</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">sample_aspect_ratio</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">sample_aspect_ratio</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">sample_aspect_ratio</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"5</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Assume r_frame_rate is accurate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">=</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">25</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">=</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> =
ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">avg_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> =
ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"6</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Initialize many things ...</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_write_header</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
ofcx, </span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">snprintf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
ofcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">filename</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">sizeof</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">( ofcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">filename</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
), </span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"%s"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"/home/Nexeya/capture6.mkv"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Video pts conversion factor</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// The input and output time_base may be different</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">time_base</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
* ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">time_base</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">time_base</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
* ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">time_base</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ix = (</span><span style="font-size:10.5pt;font-family:Consolas;color:#4EC9B0">uint32_t</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">)
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_gcd</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
/= ix ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
/= ix ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"7</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> resize =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">sws_getContext</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">width</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">height</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, AV_PIX_FMT_YUV420P,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">320</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">240</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, AV_PIX_FMT_YUV420P, SWS_BICUBIC,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">NULL</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">//start reading pkts from stream and write
them to file</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"Start record</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_init_packet</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">( &pkt );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#569CD6">int</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ii=</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">while</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(ii<</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">258</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_read_frame</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (ifcx, & pkt) >=
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Make sure we start on a key video
frame</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(got_key_frame == </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">stream_index</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> == i_vindex)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">flags</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> & AV_PKT_FLAG_KEY)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> got_key_frame =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">else</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">continue</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
; </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Not key frame</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> <o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Manage pkt</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// pts can be AV_NOPTS_VALUE = 0x8000...
at start</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
(pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> == AV_NOPTS_VALUE)<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">dts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> =
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">if</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
( pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">stream_index</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> == i_vindex )<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// pkt is video</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">stream_index</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">id</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Compute pts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">dts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> = (pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pts</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
* vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">) / vPtsFactor.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">sws_scale</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(resize,
pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">data</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">linesize</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">0</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, cctx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">height</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">,
pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">data</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">, pkt.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">linesize</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_write_frame</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
ofcx, &pkt );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_free_packet</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
&pkt );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_init_packet</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(
&pkt );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ii++;<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">(</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"End record</span><span style="font-size:10.5pt;font-family:Consolas;color:#D7BA7D">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:#CE9178">"</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#6A9955">// Stop command received</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_read_pause</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (
ifcx );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">av_write_trailer</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (
ofcx );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avio_close</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (
ofcx-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">pb</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_close_input</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (
& ifcx );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> </span><span style="font-size:10.5pt;font-family:Consolas;color:#DCDCAA">avformat_free_context</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (
ofcx );<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
</span><span style="font-size:10.5pt;font-family:Consolas;color:#C586C0">return</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> (EXIT_SUCCESS);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1E1E1E"><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thanks you very much for your help.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">De :</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Libav-user <libav-user-bounces@ffmpeg.org>
<b>De la part de</b> Michael Armes<br>
<b>Envoyé :</b> mercredi 27 février 2019 22:27<br>
<b>À :</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user@ffmpeg.org><br>
<b>Objet :</b> Re: [Libav-user] How to changes resolution to output file.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">I did not find that setting bitrate had any effect in my scenarios with mp4/mov. I had to manually control my color depth and resolution (and set framerate) to hit my desired bitrate. I never did have to convert pixel formats, but my read
of the docs is that sws_scale can do this as long as you set your SwsContext appropriately.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Feb 27, 2019 at 11:08 AM ABDALLAH Moussa <<a href="mailto:Moussa.ABDALLAH@nexeya.com">Moussa.ABDALLAH@nexeya.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">Thanks you for your help! <o:p></o:p></p>
<div>
<p class="MsoNormal">To change the bit_rate I have to use sw_scale too?<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Le 27 févr. 2019 à 18:49, Michael Armes <<a href="mailto:michael.armes@gmail.com" target="_blank">michael.armes@gmail.com</a>> a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal">You need to scale *each frame* with sws_scale from lib_av (<a href="https://libav.org/documentation/doxygen/master/group__libsws.html#gae531c9754c9205d90ad6800015046d74" target="_blank">https://libav.org/documentation/doxygen/master/group__libsws.html#gae531c9754c9205d90ad6800015046d74</a>).
I suggest you look at the example code linked in the documentation for reference.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Feb 27, 2019 at 9:38 AM ABDALLAH Moussa <<a href="mailto:Moussa.ABDALLAH@nexeya.com" target="_blank">Moussa.ABDALLAH@nexeya.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I am trying to record a stream video to a output file mkv. I set my camera with the resolution 1280x720 and I would like to change it with ffmpeg on my program how can I do that
please ?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I have success to change the framerate but I failed with the resolution or other option like bit_rate :<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">num</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">=</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">25</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">.</span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">den</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">=</span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">1</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> = ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">avg_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> = ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">r_frame_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">bit_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">3000000</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">bit_rate</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">3000000</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">height</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">320</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ivst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">width</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">240</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">height</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">320</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:14.25pt;background:#1E1E1E">
<span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4"> ovst-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">codec</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">-></span><span style="font-size:10.5pt;font-family:Consolas;color:#9CDCFE">width</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">
= </span><span style="font-size:10.5pt;font-family:Consolas;color:#B5CEA8">240</span><span style="font-size:10.5pt;font-family:Consolas;color:#D4D4D4">;</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks you for your help !<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<o:p></o:p></p>
</blockquote>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<o:p></o:p></p>
</div>
</blockquote>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>