# AI event encoder

Source: [https://docs.qualcomm.com/doc/80-70022-50/topic/gst-ai-event-encoder.html](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-ai-event-encoder.html)

The **gst-ai-event-encoder** application receives the live video stream input from
        camera, file, or RTSP source. When a human enters the video frame the application
        preprocesses the video, runs inferences on the AI hardware, and encodes the video. The
        encoding stops 5 seconds after the human moves away from the frame and restarts when anyone
        enters the frame.

The following figures show the event detection and recording pipelines for event encoder
            application. For information about the plugins used in the pipeline flow, see [Pipeline flow](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-ai-event-encoder.html#gst_ai_event_encoder__section_tsy_xsy_pgc).

Figure : gst-ai-event-encoder event detection pipeline
            
            <!--?xml version="1.0" encoding="UTF-8"?-->
<svg id="Layer_3" data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" width="1471.68255615234375" height="446.95090314745903" viewbox="0 0 1471.68255615234375 446.95090314745903">
  <g>
    <rect x=".49993896484375" y=".49985334277153" width="1470.6826171875" height="445.95068359375" rx="7.499999999999999" ry="7.499999999999999" style="fill: #fafafa;"></rect>
    <path d="M1463.68255615234375.999999970197678c3.85980224609375,0,7,3.14018177986145,7,7.000000238418579v430.950902938842773c0,3.859832763671875-3.14019775390625,7-7,7H8c-3.859802246094659,0-7-3.140167236328125-7-7V8.000000208616257C1,4.140181750059128,4.140197753905341.999999970197678,8,.999999970197678h1455.68255615234375M1463.68255615234375,0H8C3.581634521484375,0,0,3.581636399030685,0,8.000000208616257v430.950902938842773c0,4.418365478515625,3.581634521484375,8,8,8h1455.68255615234375c4.4183349609375,0,8-3.581634521484375,8-8V8.000000208616257c0-4.418363809585571-3.5816650390625-8.000000208616257-8-8.000000208616257h0Z" style="fill: #d2d7e1;"></path>
  </g>
  <g>
    <g>
      <text transform="translate(1276.438720703125 423.042429178953171)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Qualcomm </tspan></text>
      <rect x="1256.18771033692974" y="410.950943089836073" width="16" height="16" rx="2" ry="2" style="fill: #2a2aea;"></rect>
    </g>
    <g>
      <text transform="translate(1375.0205078125 423.042429178953171)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Open source</tspan></text>
      <rect x="1354.769491749782901" y="410.950943089836073" width="16" height="16" rx="2" ry="2" style="fill: #007884;"></rect>
    </g>
  </g>
  <g>
    <rect x="506.280199661983715" y="36.304283852563458" width="58.80000000000291" height="70.194326068216469" rx="4" ry="4" style="fill: #007884;"></rect>
    <rect x="1094.828135406216461" y="76.568609920779636" width="90.624677412914025" height="29.399999999999636" rx="4" ry="4" style="fill: #007884;"></rect>
    <text transform="translate(526.170679092407227 75.41129133105278)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">tee</tspan></text>
    <g>
      <path d="M46.043552111783356,53.983254243323245h-19.844999999999345c-2.435575604436963,0-4.409999999999854,1.974424395561073-4.409999999999854,4.409999999999854v35.279999999998836c0,2.435577707292396,1.974424395562892,4.409999999999854,4.409999999999854,4.409999999999854h26.459999999999127c2.435577707290577,0,4.409999999999854-1.974422292707459,4.409999999999854-4.409999999999854v-28.664999999999054l-11.024999999999636-11.024999999999636Z" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
      <path d="M43.838552111783429,53.983254243323245v8.819999999999709c0,2.435575604438782,1.974424395561073,4.409999999999854,4.409999999999854,4.409999999999854h8.819999999999709" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
      <path d="M35.01855211178372,73.82825424332259l11.024999999999636,6.614999999999782-11.024999999999636,6.615000000001601v-13.230000000001382Z" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
    </g>
    <rect x="70.362571821749953" y="46.633254243322881" width="84.280000000000655" height="58.800000000001091" rx="4" ry="4" style="fill: #007884;"></rect>
    <g>
      <line x1="154.642578125" y1="76.033254832029343" x2="166.9180908203125" y2="76.033254832029343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="165.750885009765625 80.022321909666061 172.6590576171875 76.033254832029343 165.750885009765625 72.044187754392624 165.750885009765625 80.022321909666061"></polygon>
    </g>
    <line x1="57.946988376628724" y1="76.033254243322517" x2="70.362571821749953" y2="76.033254243322517" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <rect x="172.726978781807702" y="46.633254243322881" width="93.100000000002183" height="58.800000000001091" rx="4" ry="4" style="fill: #007884;"></rect>
    <g>
      <line x1="265.826980590820312" y1="76.033254832029343" x2="278.102493286132812" y2="76.033254832029343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="276.935302734375 80.022321909666061 283.843475341796875 76.033254832029343 276.935302734375 72.044187754392624 276.935302734375 80.022321909666061"></polygon>
    </g>
    <rect x="283.91138574186698" y="46.633254243322881" width="93.100000000000364" height="58.800000000001091" rx="4" ry="4" style="fill: #007884;"></rect>
    <g>
      <line x1="377.011383056640625" y1="76.033254832029343" x2="389.286895751953125" y2="76.033254832029343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="388.119705200195312 80.022321909666061 395.027877807617188 76.033254832029343 388.119705200195312 72.044187754392624 388.119705200195312 80.022321909666061"></polygon>
    </g>
    <rect x="395.095792701925348" y="46.633254243322881" width="93.100000000001273" height="58.800000000001091" rx="3.999999999999996" ry="3.999999999999996" style="fill: #007884;"></rect>
    <g>
      <line x1="488.195793151855469" y1="76.033254832029343" x2="500.47130298614502" y2="76.033254832029343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="499.304111003875732 80.022321909666061 506.212286949157715 76.033254832029343 499.304111003875732 72.044187754392624 499.304111003875732 80.022321909666061"></polygon>
    </g>
    <text transform="translate(93.708504676818848 79.48496076464653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">filesrc</tspan></text>
    <text transform="translate(192.439949989318848 80.04355451464653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtdemux</tspan></text>
    <text transform="translate(298.054696083068848 80.04257795214653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">h264parse</tspan></text>
    <text transform="translate(401.484383583068848 80.04257795214653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">V4l2h264dec</tspan></text>
    <g>
      <line x1="565.0802001953125" y1="76.020429819822311" x2="577.355712890625" y2="76.020429819822311" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="576.188514709472656 80.00949689745903 583.096694946289062 76.020429819822311 576.188514709472656 72.031362742185593 576.188514709472656 80.00949689745903"></polygon>
    </g>
    <g>
      <line x1="565.0802001953125" y1="42.861932963132858" x2="1201.70721435546875" y2="42.861932963132858" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="1200.5400390625 46.850996226072311 1207.44818115234375 42.861932963132858 1200.5400390625 38.87286588549614 1200.5400390625 46.850996226072311"></polygon>
    </g>
    <rect x="583.164606622043721" y="51.520430551807294" width="117.600000000009459" height="49" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="700.764602661132812" y1="76.020429819822311" x2="713.040115356445312" y2="76.020429819822311" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="711.8729248046875 80.00949689745903 718.781097412109375 76.020429819822311 711.8729248046875 72.031362742185593 711.8729248046875 80.00949689745903"></polygon>
    </g>
    <rect x="718.849013582104817" y="51.520430551807294" width="87.676043671708612" height="49" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="806.525054931640625" y1="76.020429819822311" x2="818.800567626953125" y2="76.020429819822311" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="817.63336181640625 80.00949689745903 824.54156494140625 76.020429819822311 817.63336181640625 72.031362742185593 817.63336181640625 80.00949689745903"></polygon>
    </g>
    <text transform="translate(594.396981239318848 80.02988263964653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlvconverter</tspan></text>
    <text transform="translate(733.377938270568848 80.02988263964653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimltflite</tspan></text>
    <g>
      <g>
        <line x1="884.032196044921875" y1="60.772249430418015" x2="896.307708740234375" y2="60.772249430418015" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="895.140533447265625 64.761312693357468 902.0487060546875 60.772249430418015 895.140533447265625 56.783186167478561 895.140533447265625 64.761312693357468"></polygon>
      </g>
      <rect x="902.048697312977311" y="47.542251182834661" width="118.845477591261442" height="26.459999999999127" rx="4" ry="4" style="fill: #2a2aea;"></rect>
      <text transform="translate(908.068367958068848 64.78183576464653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <g>
        <line x1="884.032196044921875" y1="91.268606394529343" x2="896.307708740234375" y2="91.268606394529343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="895.140533447265625 95.257673472166061 902.0487060546875 91.268606394529343 895.140533447265625 87.279546946287155 895.140533447265625 95.257673472166061"></polygon>
      </g>
      <rect x="902.048697312977311" y="78.038609920778981" width="118.845477591261442" height="26.460000000000946" rx="4" ry="4" style="fill: #2a2aea;"></rect>
      <text transform="translate(908.068367958068848 95.27792951464653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <text transform="translate(1116.248055458068848 95.27792951464653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">appsink</tspan></text>
      <g>
        <line x1="1021.0902099609375" y1="91.268606394529343" x2="1089.087158203125" y2="91.268606394529343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1087.91998291015625 95.257673472166061 1094.828125 91.268606394529343 1087.91998291015625 87.279546946287155 1087.91998291015625 95.257673472166061"></polygon>
      </g>
      <g>
        <line x1="1021.0902099609375" y1="60.772249430418015" x2="1201.70721435546875" y2="60.772249430418015" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1200.5400390625 64.761312693357468 1207.44818115234375 60.772249430418015 1200.5400390625 56.783186167478561 1200.5400390625 64.761312693357468"></polygon>
      </g>
    </g>
    <rect x="825.232203009501973" y="51.520430551807294" width="58.799999999999272" height="49" rx="4" ry="4" style="fill: #007884;"></rect>
    <text transform="translate(845.122078895568848 80.02988263964653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">tee</tspan></text>
    <text transform="translate(1158.820321083068848 57.53671857714653)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_1</tspan></text>
    <text transform="translate(1024.265633583068848 57.53671857714653)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">video/x-raw</tspan></text>
    <text transform="translate(1024.265633583068848 88.45859357714653)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">text/x-raw</tspan></text>
    <text transform="translate(1158.820321083068848 36.30429670214653)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_0</tspan></text>
  </g>
  <g>
    <g>
      <rect x="505.381698344197503" y="318.75663471361986" width="58.80000000000291" height="70.194326068216469" rx="4" ry="4" style="fill: #007884;"></rect>
      <text transform="translate(525.272178649902344 357.863653391599655)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">tee</tspan></text>
    </g>
    <g>
      <rect x="69.46407050396374" y="330.150960781837057" width="84.280000000000655" height="58.799999999999272" rx="4" ry="4" style="fill: #007884;"></rect>
      <g>
        <line x1="153.74407958984375" y1="359.550970286130905" x2="166.019592285155341" y2="359.550970286130905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="164.852386474609375 363.54001447558403 171.760559082030341 359.550970286130905 164.852386474609375 355.561895579099655 164.852386474609375 363.54001447558403"></polygon>
      </g>
      <line x1="57.04848705884433" y1="359.550960781834874" x2="69.46407050396374" y2="359.550960781834874" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <rect x="171.828477464023308" y="330.150960781837057" width="93.100000000000364" height="58.799999999999272" rx="4" ry="4" style="fill: #007884;"></rect>
      <g>
        <line x1="264.928482055664062" y1="359.550970286130905" x2="277.203994750976562" y2="359.550970286130905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="276.036788940429688 363.54001447558403 282.944976806640625 359.550970286130905 276.036788940429688 355.561895579099655 276.036788940429688 363.54001447558403"></polygon>
      </g>
      <rect x="283.012884424080767" y="330.150960781837057" width="93.100000000000364" height="58.799999999999272" rx="4" ry="4" style="fill: #007884;"></rect>
      <g>
        <line x1="376.112884521484375" y1="359.550970286130905" x2="388.388397216796875" y2="359.550970286130905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="387.221199035644531 363.54001447558403 394.129379272460938 359.550970286130905 387.221199035644531 355.561895579099655 387.221199035644531 363.54001447558403"></polygon>
      </g>
      <rect x="394.197291384140044" y="330.150960781837057" width="93.100000000000364" height="58.799999999999272" rx="3.999999999999997" ry="3.999999999999997" style="fill: #007884;"></rect>
      <g>
        <line x1="487.29729175567627" y1="359.550970286130905" x2="499.572801679372787" y2="359.550970286130905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="498.405609667301178 363.54001447558403 505.313785552978516 359.550970286130905 498.405609667301178 355.561895579099655 498.405609667301178 363.54001447558403"></polygon>
      </g>
      <text transform="translate(88.508735656738281 363.002229899168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">rtspsrc </tspan></text>
      <text transform="translate(192.934516906738281 356.308870524168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">rtph264 </tspan><tspan x="5.41650390625" y="16.4638671875">depay </tspan></text>
      <text transform="translate(297.156196594238281 363.560823649168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">h264parse</tspan></text>
      <text transform="translate(400.585884094238281 363.560823649168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">V4l2h264dec</tspan></text>
      <g>
        <path d="M35.002050793997114,355.973960781830101c.001366012573271-.730671209330467.594799221040375-1.321890535353305,1.325471271515198-1.320524522772757.243239398956575.000454216002254.481645603182187.067958284373162.689017078400866.195092502588523l6.463295219420615,3.967236127853539c.622533313751774.382537353514635.817087486266246,1.197308338163566.43455013275161,1.819841651918978-.108734264373197.176950778957689-.257599353790283.325815868374775-.43455013275161.434550132747972l-6.463295219420615,3.969000000004598c-.622925285341807.381898086547153-1.437496078491677.18650782012628-1.819394165040649-.43641746521098-.127760868072073-.20839262008667-.195289329527441-.448105957031657-.195094184875416-.692543140416092v-7.936235286713782Z" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
        <path d="M29.710050793997652,379.34696078183697h17.639999999999418" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
        <rect x="20.890050793997943" y="347.594960781836562" width="35.279999999998836" height="24.695999999996275" rx="2" ry="2" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></rect>
      </g>
    </g>
    <g>
      <line x1="564.18170166015625" y1="325.93527814745903" x2="1200.8087158203125" y2="325.93527814745903" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="1199.64154052734375 329.92435285449028 1206.5496826171875 325.93527814745903 1199.64154052734375 321.946233958005905 1199.64154052734375 329.92435285449028"></polygon>
    </g>
    <text transform="translate(1155.043891906738281 320.204378336668015)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_0</tspan></text>
    <rect x="1093.929634088430248" y="358.906936202256475" width="90.624677412915844" height="29.400000000001455" rx="4" ry="4" style="fill: #007884;"></rect>
    <g>
      <line x1="564.18170166015625" y1="358.358770579099655" x2="576.457206726074219" y2="358.358770579099655" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="575.290016174316406 362.34781476855278 582.198196411132812 358.358770579099655 575.290016174316406 354.369695872068405 575.290016174316406 362.34781476855278"></polygon>
    </g>
    <rect x="582.266105304257508" y="333.858756833284133" width="117.60000000000764" height="49" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="699.866104125976562" y1="358.358770579099655" x2="712.141616821289062" y2="358.358770579099655" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="710.974426269532159 362.34781476855278 717.882598876953125 358.358770579099655 710.974426269532159 354.369695872068405 710.974426269532159 362.34781476855278"></polygon>
    </g>
    <rect x="717.950512264320423" y="333.858756833284133" width="87.676043671708612" height="49" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="805.626556396484375" y1="358.358770579099655" x2="817.902069091796875" y2="358.358770579099655" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="816.73486328125 362.34781476855278 823.643035888671875 358.358770579099655 816.73486328125 354.369695872068405 816.73486328125 362.34781476855278"></polygon>
    </g>
    <text transform="translate(593.498481750488281 362.367464274168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlvconverter</tspan></text>
    <text transform="translate(732.479438781738281 362.368440836668015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimltflite</tspan></text>
    <g>
      <g>
        <line x1="883.133697509765625" y1="343.11057111620903" x2="895.409210205078125" y2="343.11057111620903" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="894.242034912109375 347.09964582324028 901.15020751953125 343.11057111620903 894.242034912109375 339.121526926755905 894.242034912109375 347.09964582324028"></polygon>
      </g>
      <rect x="901.150195995192917" y="329.8805774643115" width="118.845477591259623" height="26.460000000002765" rx="4" ry="4" style="fill: #2a2aea;"></rect>
      <text transform="translate(907.169868469238281 347.119417399168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <g>
        <line x1="883.133697509765625" y1="373.606939524412155" x2="895.409210205078125" y2="373.606939524412155" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="894.242034912109375 377.596014231443405 901.15020751953125 373.606939524412155 894.242034912109375 369.617864817380905 894.242034912109375 377.596014231443405"></polygon>
      </g>
      <rect x="901.150195995192917" y="360.376936202257639" width="118.845477591259623" height="26.459999999999127" rx="4" ry="4" style="fill: #2a2aea;"></rect>
      <text transform="translate(907.169868469238281 377.616487711668015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <text transform="translate(1115.349555969238281 377.616487711668015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">appsink</tspan></text>
      <g>
        <line x1="1020.19171142578125" y1="373.606939524412155" x2="1088.18865966796875" y2="373.606939524412155" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1087.021484375 377.596014231443405 1093.92962646484375 373.606939524412155 1087.021484375 369.617864817380905 1087.021484375 377.596014231443405"></polygon>
      </g>
      <g>
        <line x1="1020.19171142578125" y1="343.11057111620903" x2="1200.8087158203125" y2="343.11057111620903" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1199.64154052734375 347.09964582324028 1206.5496826171875 343.11057111620903 1199.64154052734375 339.121526926755905 1199.64154052734375 347.09964582324028"></polygon>
      </g>
    </g>
    <rect x="824.33370169171576" y="333.858756833284133" width="58.799999999999272" height="49" rx="4" ry="4" style="fill: #007884;"></rect>
    <text transform="translate(844.223579406738281 362.367464274168015)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">tee</tspan></text>
    <text transform="translate(1157.921821594238281 339.875276774168015)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_1</tspan></text>
    <text transform="translate(1023.367134094238281 339.875276774168015)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">video/x-raw</tspan></text>
    <text transform="translate(1023.367134094238281 370.797151774168015)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">text/x-raw</tspan></text>
  </g>
  <g>
    <rect x="1206.54966227213481" y="31.06349266568759" width="90.624766031902254" height="355.008865733665516" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <text transform="translate(1209.965499877929688 212.578115671873093)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtivcomposer</tspan></text>
    <rect x="1315.190859474843819" y="171.383253795842393" width="90.624677412917663" height="74.369343473355912" rx="4" ry="4" style="fill: #007884;"></rect>
    <text transform="translate(1321.926017761230469 212.577346056699753)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">Waylandsink</tspan></text>
    <g>
      <g>
        <rect x="1418.231120332880892" y="192.691925532519235" width="35.279999999998836" height="24.695999999999913" rx="3.999999999998181" ry="3.999999999998181" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></rect>
        <line x1="1428.815120332876177" y1="224.443925532519643" x2="1442.927120332873528" y2="224.443925532519643" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></line>
      </g>
      <line x1="1435.871120332880309" y1="217.387925532519148" x2="1435.871120332880309" y2="224.443925532519643" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></line>
    </g>
    <g>
      <path d="M42.940050793997216,204.335045961450305h-8.819999999999709l-4.409999999999854,5.292000000001281h-5.292000000001281c-1.948460483550662,0-3.527999999998428,1.579539516449586-3.527999999998428,3.527999999998428v15.876000000000204c0,1.948462165833917,1.579539516447767,3.528000000002066,3.527999999998428,3.528000000002066h28.224000000001979c1.948462165832098,0,3.527999999998428-1.57953783416815,3.527999999998428-3.528000000002066v-15.876000000000204c0-1.948460483548843-1.579537834166331-3.527999999998428-3.527999999998428-3.527999999998428h-5.292000000001281l-4.409999999999854-5.292000000001281Z" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
      <circle cx="38.530050793997361" cy="218.447045961451295" r="5.29200000000128" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></circle>
    </g>
    <rect x="69.46407050396374" y="185.127045961453405" width="84.280000000000655" height="66.639999999997599" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="153.74407958984375" y1="222.36704084277153" x2="576.457206726074219" y2="222.36704084277153" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="575.290016174316406 226.35611554980278 582.198196411132812 222.36704084277153 575.290016174316406 218.377981394529343 575.290016174316406 226.35611554980278"></polygon>
    </g>
    <line x1="57.04848705884433" y1="218.447045961451295" x2="69.46407050396374" y2="218.447045961451295" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <line x1="1405.815536887761482" y1="208.567923503847851" x2="1418.231120332880892" y2="208.567927561194665" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <g>
      <line x1="1297.17437744140625" y1="208.567922800779343" x2="1309.44989013671875" y2="208.567922800779343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="1308.28265380859375 212.55698224902153 1315.19085693359375 208.567922800779343 1308.28265380859375 204.578863352537155 1308.28265380859375 212.55698224902153"></polygon>
    </g>
    <text transform="translate(76.044868469238281 222.456854075193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtiqmmfsrc</tspan></text>
    <g>
      <g>
        <line x1="153.74407958984375" y1="190.188543528318405" x2="1200.8087158203125" y2="190.188543528318405" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1199.64154052734375 194.177618235349655 1206.5496826171875 190.188543528318405 1199.64154052734375 186.199484080076218 1199.64154052734375 194.177618235349655"></polygon>
      </g>
      <text transform="translate(1157.921821594238281 183.630682200193405)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_0</tspan></text>
    </g>
    <rect x="1093.929634088430248" y="222.911993202777012" width="90.624677412915844" height="29.399999999997817" rx="4" ry="4" style="fill: #007884;"></rect>
    <g>
      <line x1="564.18170166015625" y1="222.363821238279343" x2="576.457206726074219" y2="222.363821238279343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="575.290016174316406 226.35288068652153 582.198196411132812 222.363821238279343 575.290016174316406 218.374746531248093 575.290016174316406 226.35288068652153"></polygon>
    </g>
    <rect x="582.266105304257508" y="197.863813833802851" width="117.60000000000764" height="48.999999999998181" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="699.866104125976562" y1="222.363821238279343" x2="712.141616821289062" y2="222.363821238279343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="710.974426269532159 226.35288068652153 717.882598876953125 222.363821238279343 710.974426269532159 218.374746531248093 710.974426269532159 226.35288068652153"></polygon>
    </g>
    <rect x="717.950512264320423" y="197.863813833802851" width="87.676043671708612" height="48.999999999998181" rx="4" ry="4" style="fill: #2a2aea;"></rect>
    <g>
      <line x1="805.626556396484375" y1="222.363821238279343" x2="817.902069091796875" y2="222.363821238279343" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
      <polygon points="816.73486328125 226.35288068652153 823.643035888671875 222.363821238279343 816.73486328125 218.374746531248093 816.73486328125 226.35288068652153"></polygon>
    </g>
    <text transform="translate(593.498481750488281 226.372869700193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlvconverter</tspan></text>
    <text transform="translate(732.479438781738281 226.373357981443405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimltflite</tspan></text>
    <g>
      <g>
        <line x1="883.133697509765625" y1="207.11563703417778" x2="895.409210205078125" y2="207.11563703417778" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="894.242034912109375 211.104696482419968 901.15020751953125 207.11563703417778 894.242034912109375 203.126577585935593 894.242034912109375 211.104696482419968"></polygon>
      </g>
      <rect x="901.150195995192917" y="193.885634464830218" width="118.845477591259623" height="26.460000000000946" rx="4" ry="4" style="fill: #2a2aea;"></rect>
      <text transform="translate(907.169868469238281 211.124822825193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <g>
        <line x1="883.133697509765625" y1="237.611990183591843" x2="895.409210205078125" y2="237.611990183591843" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="894.242034912109375 241.60104963183403 901.15020751953125 237.611990183591843 894.242034912109375 233.622930735349655 894.242034912109375 241.60104963183403"></polygon>
      </g>
      <rect x="901.150195995192917" y="224.381993202774538" width="118.845477591259623" height="26.459999999999127" rx="3.999999999999976" ry="3.999999999999976" style="fill: #2a2aea;"></rect>
      <text transform="translate(907.169868469238281 241.620916575193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">qtimlpostprocess</tspan></text>
      <text transform="translate(1115.349555969238281 241.620916575193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">appsink</tspan></text>
      <g>
        <line x1="1020.19171142578125" y1="237.611990183591843" x2="1088.18865966796875" y2="237.611990183591843" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1087.021484375 241.60104963183403 1093.92962646484375 237.611990183591843 1087.021484375 233.622930735349655 1087.021484375 241.60104963183403"></polygon>
      </g>
      <g>
        <line x1="1020.19171142578125" y1="207.11563703417778" x2="1200.8087158203125" y2="207.11563703417778" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="1199.64154052734375 211.104696482419968 1206.5496826171875 207.11563703417778 1199.64154052734375 203.126577585935593 1199.64154052734375 211.104696482419968"></polygon>
      </g>
    </g>
    <rect x="824.33370169171576" y="197.863813833802851" width="58.799999999999272" height="48.999999999998181" rx="4" ry="4" style="fill: #007884;"></rect>
    <text transform="translate(844.223579406738281 226.372869700193405)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">tee</tspan></text>
    <text transform="translate(1157.921821594238281 203.880193918943405)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">sink_1</tspan></text>
    <text transform="translate(1023.367134094238281 203.880193918943405)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">video/x-raw</tspan></text>
    <text transform="translate(1023.367134094238281 234.802557200193405)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">text/x-raw</tspan></text>
  </g>
  <text transform="translate(21.78857421875 31.063482493162155)" style="font-family: Roboto-Bold, Roboto; font-size: 14px; font-weight: 700;"><tspan x="0" y="0">File (default)</tspan></text>
  <text transform="translate(21.7884521484375 165.276190012693405)" style="font-family: Roboto-Bold, Roboto; font-size: 14px; font-weight: 700;"><tspan x="0" y="0">Camera (optional)</tspan></text>
  <text transform="translate(21.7884521484375 310.93564435839653)" style="font-family: Roboto-Bold, Roboto; font-size: 14px; font-weight: 700;"><tspan x="0" y="0">RTSP (optional)</tspan></text>
  <g>
    <line x1="23.999572753905341" y1="281.767034739255905" x2="27.999572753905341" y2="281.767034739255905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <line x1="31.981109619140625" y1="281.767034739255905" x2="1200.55889892578125" y2="281.767034739255905" style="fill: none; stroke: #000; stroke-dasharray: 7.963051319122314 3.981525659561157; stroke-miterlimit: 10;"></line>
    <line x1="1202.5496826171875" y1="281.767034739255905" x2="1206.5496826171875" y2="281.767034739255905" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
  </g>
  <g>
    <line x1="23.999572753905341" y1="135.433248728513718" x2="27.999572753905341" y2="135.433248728513718" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <line x1="32.012542724609375" y1="135.433248728513718" x2="1197.77392578125" y2="135.433248728513718" style="fill: none; stroke: #000; stroke-dasharray: 8.025896072387695 4.012948036193848; stroke-miterlimit: 10;"></line>
    <line x1="1199.7803955078125" y1="135.433248728513718" x2="1203.7803955078125" y2="135.433248728513718" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
  </g>
  <text transform="translate(1094.5238037109375 120.975332468748093)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">Event detection</tspan></text>
  <text transform="translate(1094.5238037109375 267.12045881152153)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">Event detection</tspan></text>
  <text transform="translate(1094.5238037109375 405.980230540037155)" style="font-family: Roboto-Regular, Roboto; font-size: 13.720000267028809px;"><tspan x="0" y="0">Event detection</tspan></text>
</svg>

Figure :  gst-ai-event-encoder recording pipeline
            
            <!--?xml version="1.0" encoding="UTF-8"?-->
<svg id="Layer_3" data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" width="687.555450439453125" height="150" viewbox="0 0 687.555450439453125 150">
  <g>
    <rect x=".48883056640625" y=".488128662109375" width="686.578125" height="149.0234375" rx="7.328613281250057" ry="7.328613281250057" style="fill: #fafafa;"></rect>
    <path d="M679.737823486328125.977188110351562c3.771820068359375,0,6.8404541015625,3.068634033203125,6.8404541015625,6.840545654296875v134.364639282226562c0,3.771820068359375-3.068634033203125,6.8404541015625-6.8404541015625,6.8404541015625H7.817642211914062c-3.771820068359375,0-6.8404541015625-3.068634033203125-6.8404541015625-6.8404541015625V7.817733764648438C.977188110351562,4.045822143554688,4.045822143554688.977188110351562,7.817642211914062.977188110351562h671.920181274414062M679.737823486328125,0H7.817642211914062C3.500091552734375,0,0,3.500091552734375,0,7.817733764648438v134.364639282226562c0,4.317535400390625,3.500091552734375,7.817626953125,7.817642211914062,7.817626953125h671.920181274414062c4.317535400390625,0,7.817626953125-3.500091552734375,7.817626953125-7.817626953125V7.817733764648438c0-4.317642211914062-3.500091552734375-7.817733764648438-7.817626953125-7.817733764648438h0Z" style="fill: #d2d7e1;"></path>
  </g>
  <g>
    <path d="M653.360458374023438,35.914999016727961h-20.25c-2.485281229017346,0-4.5,2.014718770980835-4.5,4.5v36c0,2.485283374786377,2.014718770982654,4.5,4.5,4.5h27c2.485283374786377,0,4.5-2.014716625213623,4.5-4.5v-29.25l-11.25-11.25Z" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
    <path d="M651.110458374023438,35.914999016727961v9c0,2.485281229019165,2.014718770980835,4.5,4.5,4.5h9" style="fill: none; stroke: #000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2px;"></path>
  </g>
  <g>
    <text transform="translate(586.1199951171875 125.676521301269531)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Open source</tspan></text>
    <rect x="565.868940490408932" y="113.585030793863552" width="16" height="16" rx="2" ry="2" style="fill: #007884;"></rect>
  </g>
  <g>
    <line x1="123.846559524536133" y1="58.415008544921875" x2="163.105575561523438" y2="58.415008544921875" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <polygon points="161.938383102416992 62.404052734375 168.846561431884766 58.415008544921875 161.938383102416992 54.425933837890625 161.938383102416992 62.404052734375"></polygon>
  </g>
  <g>
    <line x1="273.8465576171875" y1="58.415008544921875" x2="313.105575561523438" y2="58.415008544921875" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <polygon points="311.938385009765625 62.404052734375 318.8465576171875 58.415008544921875 311.938385009765625 54.425933837890625 311.938385009765625 62.404052734375"></polygon>
  </g>
  <g>
    <line x1="583.610456318267097" y1="58.415008544921875" x2="622.869474262603035" y2="58.415008544921875" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <polygon points="621.702283710845222 62.404052734375 628.610456318267097 58.415008544921875 621.702283710845222 54.425933837890625 621.702283710845222 62.404052734375"></polygon>
  </g>
  <g>
    <line x1="423.846572875976562" y1="58.415008544921875" x2="463.105575561523438" y2="58.415008544921875" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
    <polygon points="461.938369750976562 62.404052734375 468.846572875976562 58.415008544921875 461.938369750976562 54.425933837890625 461.938369750976562 62.404052734375"></polygon>
  </g>
  <rect x="18.374970779728756" y="28.414999016727961" width="106" height="60" rx="4" ry="4" style="fill: #007884;"></rect>
  <text transform="translate(50.07073974609375 62.506072998046875)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">appsrc</tspan></text>
  <text transform="translate(634.6195068359375 97.480987548828125)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">File</tspan></text>
  <rect x="168.84655967294384" y="28.414999016727961" width="105" height="60" rx="4" ry="4" style="fill: #007884;"></rect>
  <text transform="translate(181.513565063476562 62.506683349609375)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">v4l2h264enc</tspan></text>
  <rect x="318.84655967294384" y="28.414999016727961" width="105" height="60" rx="4" ry="4" style="fill: #007884;"></rect>
  <text transform="translate(343.889785766601562 62.506195068359375)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">mp4mux</tspan></text>
  <rect x="468.84655967294384" y="28.414999016727961" width="115" height="60" rx="4" ry="4" style="fill: #007884;"></rect>
  <text transform="translate(504.0919189453125 62.506011962890625)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">filesink</tspan></text>
</svg>

## Sample model and label files

Table : Sample model and label files for gst-ai-event-encoder

| Runtime | Model files | Label files |
| :--- | :--- | :--- |
| LiteRT | *yolox\_quantized.tflite* | *yolox.json* |

## Run the application on the target device

Use the following command to run the application:

    gst-ai-event-encoder --config-file=/etc/configs/config-event-encoder.jsonCopy to clipboard

The sample application uses the
                    /etc/configs/config-event-encoder.json file to read the
                input parameters.

To create your own config JSON file, use [config-event-encoder.json](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-sample-apps/gst-ai-event-encoder/config-event-encoder.json?ref_type=heads) as a
                reference.

1. Ensure that you complete the [Prerequisites](https://docs.qualcomm.com/doc/80-70022-50/topic/download-model-and-label-files.html).
2. Update the config JSON file based on the model, input stream, and other
                    properties. For more information, see [Config JSON field description](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-ai-event-encoder.html#gst_ai_event_encoder__section_apm_bty_pgc).
3. Use the following format of the config-event-encoder.json
                    file. 

        {
          "file-path": "<path to video file>",
          "model": "<path to model file>",
          "labels": "<path to label file>",
          "threshold": <integer between 1 and 100>,
          "runtime": "<cpu, gpu, or dsp runtime>"
        }Copy to clipboard

Note: The application supports only 1080P video format
                            as input.

For example, run the application using input from a camera, YOLOX model,
                        and human count on console:

        {
        "file-path": "/etc/media/video.mp4",
        "model": "/etc/models/yolox_quantized.tflite", 
        "labels": "/etc/labels/yolox.json",
        "threshold": 40,
        "runtime": "dsp"
        }Copy to clipboard
4. Run the gst-ai-event-encoder
                    application:

        gst-ai-event-encoder --config-file=/etc/configs/config-event-encoder.jsonCopy to clipboard
5. To display the available help options, run the following command in the SSH
                    shell:

        gst-ai-event-encoder -hCopy to clipboard
6. To stop the use case, use CTRL +
                    C.

## Expected output

The output is saved as an MP4 file within `etc/media` folder as
                    `output-1.mp4`, `output-2.mp4`, and so on.

## Pipeline flow

The following table lists the plugins used in the AI event encoder
                    pipeline

| Plugin | Description |
| --- | --- |
| Camera source:[qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50/topic/qtiqmmfsrc.html) | <ul class="ul" id="gst_ai_event_encoder__ul_zyl_gj1_mcc"><br>                                    <li class="li">Captures the live stream from camera.</li><br><br>                                    <li class="li">Uses tee to split the stream into two for inferencing and<br>                                        composing.</li><br><br>                                </ul> |
| File source: filesrc | <ul class="ul" id="gst_ai_event_encoder__ul_z1z_x4f_w1c"><br>                                    <li class="li">Captures the video stream using filesrc, followed by<br>                                        qtdemux, which demultiplexes the stream.</li><br><br>                                    <li class="li">Uses tee to split the stream into two for inferencing and<br>                                        composing.</li><br><br>                                </ul> |
| RTSP source: rtspsrc | <ul class="ul" id="gst_ai_event_encoder__ul_vsj_2r4_tbc"><br>                                    <li class="li">Captures the RTSP stream using rtspsrc, followed by<br>                                        rtph264depay for video extraction.</li><br><br>                                    <li class="li">Uses tee to split the stream into two for inferencing and<br>                                        composing.</li><br><br>                                </ul> |
| h264parse | Parses the H.264 video. |
| [v4l2h264dec](https://docs.qualcomm.com/doc/80-70022-50/topic/v4l2h264dec.html) | Decodes the video. |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70022-50/topic/qtimlvconverter.html) | <ol class="ol" id="gst_ai_event_encoder__ol_j34_ddg_q1c"><br>                                    <li class="li">Receives the video stream on its sink pad.</li><br><br>                                    <li class="li">Performs the following preprocessing on the stream data.<br>                                        This preprocessing is done when the model expects<br>                                        floating-point values as input.<ol class="ol" type="a" id="gst_ai_event_encoder__ol_m5z_cpr_lbc"><br>                                            <li class="li">Color conversion</li><br><br>                                            <li class="li">Scaling (up or down)</li><br><br>                                            <li class="li">Normalization</li><br><br>                                        </ol><br></li><br><br>                                    <li class="li">Converts the preprocessed video stream to a tensor stream on<br>                                        its source pad. </li><br><br>                                </ol><br><br>                                <br>The tensor stream is used for inferencing in the later stages of<br>                                    the pipeline. |
| Inferencing plugin:[qtimltflite](https://docs.qualcomm.com/doc/80-70022-50/topic/qtimltflite.html) | <ol class="ol" id="gst_ai_event_encoder__ol_l2x_zjq_nbc"><br>                                    <li class="li">After the inference runtime receives the tensor stream on<br>                                        its sink pad, it runs the inference.</li><br><br>                                    <li class="li">Produces a tensor stream with the inference results on its<br>                                        source pad.</li><br><br>                                </ol> |
| qtimlpostprocess | The first qtimlpostprocess plugin for detection model handles<br>                                inference results from any object detection model.<ol class="ol" id="gst_ai_event_encoder__ol_ol3_dky_kbc"><br>                                    <li class="li">Applies a threshold to the chosen number of results.</li><br><br>                                    <li class="li">Loads the YOLOv8 module.</li><br><br>                                    <li class="li">Produces video frames with only bounding boxes that can be<br>                                        overlaid on objects. </li><br><br>                                    <li class="li">Sends these processed frames to the sink pad of<br>                                        qtivcomposer.</li><br><br>                                </ol> |
| qtimlpostprocess | The second qtimlpostprocess plugin for detection model does the<br>                                    following:<br><ul class="ul" id="gst_ai_event_encoder__ul_i4s_qqy_m2c"><br>                                    <li class="li">Produces the output in a text format (bounding box<br>                                        coordinates and labels). </li><br><br>                                    <li class="li">This output is connected to appsink plugin where the<br>                                        metadata is read, parsed, and logged. </li><br><br>                                    <li class="li">The bounding box information is used to count number of<br>                                        humans in each frame.</li><br><br>                                </ul> |
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70022-50/topic/qtivcomposer.html) | <ol class="ol" id="gst_ai_event_encoder__ol_dmb_2vr_lbc"><br>                                    <li class="li">Composes frames with contents from its sink pads.</li><br><br>                                    <li class="li">Pushes the GStreamer buffers containing these composed<br>                                        frames to its source pad.</li><br><br>                                </ol> |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50/topic/waylandsink.html) | <ol class="ol" id="gst_ai_event_encoder__ol_kjr_fvr_lbc"><br>                                    <li class="li">Waylandsink submits the video stream received on its sink<br>                                        pad to Weston.</li><br><br>                                    <li class="li">Weston renders the video stream on a local display.</li><br><br>                                </ol> |
|  |  |

## Config JSON field description

The different parameters available to configure the JSON file and run the use case
                are as follows:

Table : Field description–gst-ai-event-encoder file

| Field | Values/description |
| :--- | :--- |
| **runtime** | Use one of the following runtimes:<ul class="ul" id="gst_ai_event_encoder__ul_mry_nck_32c"><br>                                    <li class="li"><code class="ph codeph">cpu</code></li><br><br>                                    <li class="li"><code class="ph codeph">gpu</code></li><br><br>                                    <li class="li"><code class="ph codeph">dsp</code></li><br><br>                                </ul> |
| **Input source** | Use one of the following input sources:<ul class="ul" id="gst_ai_event_encoder__ul_xym_rck_32c"><br>                                    <li class="li"><code class="ph codeph">camera</code>–Primary (0) or secondary (1).</li><br><br>                                    <li class="li"><code class="ph codeph">file-path</code>–The directory path to the video<br>                                        file.</li><br><br>                                    <li class="li"><code class="ph codeph">rtsp-ip-port</code>–The address of the RTSP<br>                                        stream:<br>                                                <u class="ph u"><var class="keyword varname">rtsp://&lt;ip&gt;:&lt;port&gt;/&lt;stream&gt;</var></u>.</li><br><br>                                </ul> |

## Known issue

The MP4 file generated after end of stream (EOS) using file source isn't
                playable.

## Related information

[Object detection](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-ai-object-detection.html)

**Parent Topic:** [Run AI/ML sample applications](https://docs.qualcomm.com/doc/80-70022-50/topic/ai-ml-sample-applications.html)

Last Published: Feb 20, 2026

[Previous Topic
Metadata parsing](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/gst-ai-metadata-parser.md) [Next Topic
AI USB camera](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/ai-usb-camera.md)