<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:472067703;
        mso-list-type:hybrid;
        mso-list-template-ids:-2142181578 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;
        mso-bidi-font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-bidi-font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;
        mso-bidi-font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-bidi-font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;
        mso-bidi-font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-bidi-font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I have an ffmpeg / libav based video playback library which is tuned for computer vision use: <o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>it discards any non-video packets, and attempts to deliver video as quickly as possible while only consuming 1 thread per video stream.<o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'><o:p> </o:p></p><p class=MsoNormal>For USB and IP streams, video frames are delivered as soon as they are received, and media files playback as fast as the disk can deliver frames.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Other than discarding non-video packets and playing as fast as possible, my player library supports monitoring USB & IP stream dropping – typically someone tripping over or disconnecting the wire. <o:p></o:p></p><p class=MsoNormal>For the added support of my library’s stream monitoring, I need to recompile ffmpeg.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Between ffmpeg versions 3.2.2 and 4.2.2 I am seeing a fairly significant difference in playback performance. <o:p></o:p></p><p class=MsoNormal>The new version is noticeably slower.<o:p></o:p></p><p class=MsoNormal>Case in point, decompressing 3000 frames ASAP without any display:<o:p></o:p></p><p class=MsoNormal>Version 3.2.2: 0.002319 seconds per frame (measured using boost high_resolution_clock::time_point)<o:p></o:p></p><p class=MsoNormal>Version 4.2.2: 0.004250 seconds per frame<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In a computer vision context, this increase in processing for version 4.2.2 triggers a need for significantly faster hardware to maintain the same computer vision application performance. <o:p></o:p></p><p class=MsoNormal>So I am investigating to learn if it is possible to get better performance out of version 4.2.2.  <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Between the two ffmpeg versions, my player library requires slightly different setup to play a stream, but the playback code handling receiving of packets, conversion to video frames, delivery to the player library, and final presentation is unmodified.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Other than the change of getting libav from ffmpeg 3.2.2 to getting libav from ffmpeg version 4.2.2, I have these differences between my video player library versions: <o:p></o:p></p><ul style='margin-top:0in' type=disc><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The 3.2.2 version was created by cross compiling with the Zeranoe build script (back when 3.2.2 was “new”) after I added the USB/IP stream dropping support to the source code<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The 3.2.2 version is used as dlls, while the 4.2.2 libav libraries are static builds, requiring no libav dlls by the final executable. <o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>The 4.2.2 version is created by native compiling using Visual Studio’s build tools via a Msys2 shell launched from a “VS2015 x64 Native Tools Command Prompt” and this confiture line:<o:p></o:p></li><ul style='margin-top:0in' type=circle><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level2 lfo1'>./configure --prefix="./ffmpeg_build"  --toolchain=msvc  --arch=x86_64 --target-os=win64 --extra-cflags=-MT --extra-cxxflags=-MT --optflags=-O2 --enable-x86asm --enable-asm --enable-static --disable-shared --disable-debug --enable-gpl --disable-w32threads<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level2 lfo1'>The “--optflags=-O2" Is an experiment to see if I get any faster demux processing – it results in slightly different size for a few of the libraries. But no noticeable difference other than that. <o:p></o:p></li></ul></ul><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Does anyone have any ideas why demuxing frames with the new version requires so much more CPU? <o:p></o:p></p><p class=MsoNormal>Is anyone seeing better performance from the 4.2 series than the 3.2 series? <o:p></o:p></p><p class=MsoNormal>Any ideas on this topic? <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:black'>Blake Senftner<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Sr. Software Scientist | CyberExtruder<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>1401 Valley Road, Wayne, New Jersey 07470<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>cel: 213 400 6424 (pacific daylight savings timezone)<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><a href="mailto:bsenftner@cyberextruder.com"><span style='color:blue'>bsenftner@cyberextruder.com</span></a><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> <o:p></o:p></p></div></body></html>