<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 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:NSimSun;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-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.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"\6279\6CE8\6846\6587\672C Char";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.Char
{mso-style-name:"\6279\6CE8\6846\6587\672C Char";
mso-style-priority:99;
mso-style-link:\6279\6CE8\6846\6587\672C;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
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="ZH-CN" link="blue" vlink="purple" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> I used gdigrab to grab desktop. I set the framerate to 30, but, actually, the framerate was only 15 in my test. Why?
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Here is the options of my desktop:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <img width="516" height="319" id="_x56fe__x7247__x0020_3" src="cid:image001.png@01D24692.EAF99380"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Here is my code:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> ……<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:yellow;mso-highlight:yellow">av_dict_set(&options,</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#A31515;background:yellow;mso-highlight:yellow">"framerate"</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:yellow;mso-highlight:yellow">,</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#A31515;background:yellow;mso-highlight:yellow">"30"</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:yellow;mso-highlight:yellow">,0);</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#2B91AF;background:white;mso-highlight:white">AVInputFormat</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"> *ifmt
= av_find_input_format(</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#A31515;background:white;mso-highlight:white">"gdigrab"</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:blue;background:white;mso-highlight:white">if</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"> (avformat_open_input(&fct,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#A31515;background:white;mso-highlight:white">"desktop"</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">, ifmt,
&options) != 0){<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"> printf(</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:#A31515;background:white;mso-highlight:white">"Couldn't
open input stream\n"</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">);<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:blue;background:white;mso-highlight:white">return</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"> -1;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black;background:white;mso-highlight:white"> }</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> ……<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> while(av_read_frame(vs->in_fct, packet)>=0)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> icount++;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> finish = clock();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> duration = (double)(finish - start) / CLOCKS_PER_SEC;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:red">printf("%f seconds, count: %d\n", duration, icount);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> start = clock();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> av_free_packet(packet);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:NSimSun;color:black"> Here is the result:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><img width="739" height="471" id="_x56fe__x7247__x0020_1" src="cid:image002.png@01D24692.EAF99380"></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> From the result, we can see, the average time was 60ms to get one picture.
<span style="background:yellow;mso-highlight:yellow">Why was it so slow? Were there any options about it to increase the fps?</span><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Thank you and look forward for your mail.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best wish<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Jack<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<span style="font-size:7.5pt;font-family:华文细黑;color:gray"><span lang="EN-US">-------------------------------------------------------------------------------------------------------------------------------------<br>
</span>本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出<span lang="EN-US"><br>
</span>的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、<span lang="EN-US"><br>
</span>或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本<span lang="EN-US"><br>
</span>邮件!<span lang="EN-US"><br>
</span></span><span lang="EN-US" style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray">This e-mail and its attachments contain confidential information from H3C, which is
<br>
intended only for the person or entity whose address is listed above. Any use of the
<br>
information contained herein in any way (including, but not limited to, total or partial
<br>
disclosure, reproduction, or dissemination) by persons other than the intended <br>
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
<br>
by phone or email immediately and delete it!</span>
</body>
</html>