<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
Hi!
<div><br>
</div>
<div>Thanks you for your answer. When I tried to do this, I had an error in the enconding step. I got on the console a message whixh tell me that I can’t use the function avcodec_encode_video2() but I have to use avcodec_send_frame() and avcodec_receive_packet().</div>
<div>
<div dir="ltr"><br>
Le 3 mars 2019 à 06:30, Yurii Monakov <<a href="mailto:monakov.y@gmail.com">monakov.y@gmail.com</a>> a écrit :<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div dir="auto">Hi!</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">You should decode input packets from camera to AVFrames using decoding API. After that it will be possible to change video frame resolution and encode scaled frames into video file with encoding API.</div>
<div dir="auto"><br>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">чт, 28 февр. 2019 г. в 18:39, ABDALLAH Moussa <<a href="mailto:Moussa.ABDALLAH@nexeya.com">Moussa.ABDALLAH@nexeya.com</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="FR" link="blue" vlink="purple">
<div class="m_1750016192794304002WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Could you help me please ?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">This is my source code :<u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"> {<u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4">}<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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) {<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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">;<u></u><u></u></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">;<u></u><u></u></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">;<u></u><u></u></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;<u></u><u></u></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">;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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;<u></u><u></u></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;<u></u><u></u></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">;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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;<u></u><u></u></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;<u></u><u></u></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;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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"> } ;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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">"<a href="http://192.9.200.121/ipcam/mjpeg.cgi" target="_blank">http://192.9.200.121/ipcam/mjpeg.cgi</a>"</span><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4">,<u></u><u></u></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">) {<u></u><u></u></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;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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">) {<u></u><u></u></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;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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">;<u></u><u></u></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++) {<u></u><u></u></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"><u></u><u></u></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">;<u></u><u></u></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)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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 ];<u></u><u></u></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;<u></u><u></u></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"> ;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></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"> )<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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">
);<u></u><u></u></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 );<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></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">);<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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"> );<u></u><u></u></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">();<u></u><u></u></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;<u></u><u></u></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"> );<u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></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"> );<u></u><u></u></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);<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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">;<u></u><u></u></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">;<u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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">;<u></u><u></u></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">;<u></u><u></u></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">;<u></u><u></u></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">;<u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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"> );<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"> );<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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"><u></u><u></u></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">
;<u></u><u></u></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">
;<u></u><u></u></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">) ;<u></u><u></u></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 ;<u></u><u></u></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 ;<u></u><u></u></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">);<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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">);<u></u><u></u></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"><u></u><u></u></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">);<u></u><u></u></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 );<u></u><u></u></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">;<u></u><u></u></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">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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"><u></u><u></u></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">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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">;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></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"><u></u><u></u></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"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> <u></u><u></u></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"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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)<u></u><u></u></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"> ;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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 )<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> {<u></u><u></u></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"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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">;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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"><u></u><u></u></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">
;<u></u><u></u></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">);<u></u><u></u></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 );<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"><u></u> <u></u></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 );<u></u><u></u></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 );<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> ii++;<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4"> }<u></u><u></u></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">);<u></u><u></u></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"><u></u><u></u></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 );<u></u><u></u></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 );<u></u><u></u></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"> );<u></u><u></u></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 );<u></u><u></u></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 );<u></u><u></u></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);<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:#1e1e1e"><span style="font-size:10.5pt;font-family:Consolas;color:#d4d4d4">}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks you very much for your help.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></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 <<a href="mailto:libav-user-bounces@ffmpeg.org" target="_blank">libav-user-bounces@ffmpeg.org</a>>
<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. <<a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a>><br>
<b>Objet :</b> Re: [Libav-user] How to changes resolution to output file.<u></u><u></u></span></p>
</div>
</div>
<div lang="FR" link="blue" vlink="purple">
<div class="m_1750016192794304002WordSection1">
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Feb 27, 2019 at 11:08 AM ABDALLAH Moussa <<a href="mailto:Moussa.ABDALLAH@nexeya.com" target="_blank">Moussa.ABDALLAH@nexeya.com</a>> wrote:<u></u><u></u></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! <u></u><u></u></p>
<div>
<p class="MsoNormal">To change the bit_rate I have to use sw_scale too?<u></u><u></u></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 :<u></u><u></u></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.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></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:<u></u><u></u></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">Hello,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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 ?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I have success to change the framerate but I failed with the resolution or other option like bit_rate :<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></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">;</span><u></u><u></u></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">;
</span><u></u><u></u></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">;</span><u></u><u></u></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">;</span><u></u><u></u></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">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><u></u><u></u></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">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><u></u><u></u></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">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><u></u><u></u></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">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><u></u><u></u></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">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><u></u><u></u></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">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><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks you for your help !<u></u><u></u></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".<u></u><u></u></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".<u></u><u></u></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".<u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
_______________________________________________<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" rel="noreferrer" 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".</blockquote>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div dir="ltr"><span>_______________________________________________</span><br>
<span>Libav-user mailing list</span><br>
<span><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a></span><br>
<span><a href="https://ffmpeg.org/mailman/listinfo/libav-user">https://ffmpeg.org/mailman/listinfo/libav-user</a></span><br>
<span></span><br>
<span>To unsubscribe, visit link above, or email</span><br>
<span><a href="mailto:libav-user-request@ffmpeg.org">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</span></div>
</blockquote>
</div>
</body>
</html>