<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processorsのトピック8MMINILPD4-EVK rtsp stream slow processing</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/8MMINILPD4-EVK-rtsp-stream-slow-processing/m-p/1459981#M190529</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Development platform:&lt;/STRONG&gt; 8MMINILPD4-EVK board&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Application as follows:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Capture IP camera video stream.&lt;/LI&gt;&lt;LI&gt;Store video stream to Hard Disk (Time based / event driven storage)&lt;/LI&gt;&lt;LI&gt;Perform Object detection logic.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Setup Information:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;8MMINILPD4-EVK development board&lt;/LI&gt;&lt;LI&gt;Linux kernal LF5.15.5_1.0.0&lt;/LI&gt;&lt;LI&gt;Yocto Project Setup : build type :imx-image-full&lt;/LI&gt;&lt;LI&gt;IP camera and development board connected to local LAN network.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IP camera protocol&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : RTSP&lt;/P&gt;&lt;P&gt;Frame Setting &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1080P @ 30 pfs, Mainstream: video H264, bitrate 2048 kbps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;During IP camera RTSP stream integration with development board we face following problem –&lt;/P&gt;&lt;P&gt;When ffmpeg library transcodes the input video from rtsp stream using default /specific options, cpu utilization is very high and resulting video stream has lag and missing frames.&lt;/P&gt;&lt;P&gt;The performance is optimum when no video transcoding happens and input stream is copied as is from the input.&lt;/P&gt;&lt;P&gt;The above conclusion can be inferred from following results -&lt;/P&gt;&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;[following commands were executed on the target board to record 15s of video from the IP camera using FFMPEG library (binaries)]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;1080p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.264&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out11.mp4&lt;/P&gt;&lt;P&gt;Execution time - 47.43s&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CPU Utilisation - ~60-70%&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;h264&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s out12.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.516s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;1080p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.265&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out21.mp4&lt;/P&gt;&lt;P&gt;Execution time - 46.58s&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CPU Utilisation - ~60-70%&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;hevc&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s ~/sample_ipcam_vid/out22.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.483s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;720p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.264&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out31.mp4&lt;/P&gt;&lt;P&gt;Execution time - 24.516s&lt;/P&gt;&lt;P&gt;[Missed Frames]&lt;BR /&gt;CPU Utilisation - ~60-70%&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;h264&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s ~/sample_ipcam_vid/out32.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.494s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;BR /&gt;&lt;BR /&gt;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&lt;/P&gt;&lt;P&gt;Similar performance is observed when using pre-saved local video file as input - thus ruling out bottlenecks caused due to network infrastructure&lt;/P&gt;&lt;P&gt;also, similar performance/lag is observed when reading video frames from opencv-python (both when input is ip camera url or saved local video file)&lt;/P&gt;&lt;P&gt;Python line -&lt;/P&gt;&lt;P&gt;&lt;EM&gt;video = cv2.VideoCapture(camUrl)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The performance doesn’t much vary when resolution/compression settings are changed in th eIP camera settings.&lt;/P&gt;&lt;P&gt;Desired performance – (to achieve live streaming, recording and ComputerVision applications)&lt;BR /&gt;CPU utilisation – as low as possible&lt;BR /&gt;Execution time –&amp;nbsp; around 1x (i.e. approx 15s for 15s Stream)&lt;/P&gt;&lt;P&gt;Kindly suggest how we can optimized same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 11:27:34 GMT</pubDate>
    <dc:creator>ashish_m</dc:creator>
    <dc:date>2022-05-18T11:27:34Z</dc:date>
    <item>
      <title>8MMINILPD4-EVK rtsp stream slow processing</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/8MMINILPD4-EVK-rtsp-stream-slow-processing/m-p/1459981#M190529</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Development platform:&lt;/STRONG&gt; 8MMINILPD4-EVK board&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Application as follows:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Capture IP camera video stream.&lt;/LI&gt;&lt;LI&gt;Store video stream to Hard Disk (Time based / event driven storage)&lt;/LI&gt;&lt;LI&gt;Perform Object detection logic.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Setup Information:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;8MMINILPD4-EVK development board&lt;/LI&gt;&lt;LI&gt;Linux kernal LF5.15.5_1.0.0&lt;/LI&gt;&lt;LI&gt;Yocto Project Setup : build type :imx-image-full&lt;/LI&gt;&lt;LI&gt;IP camera and development board connected to local LAN network.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IP camera protocol&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : RTSP&lt;/P&gt;&lt;P&gt;Frame Setting &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1080P @ 30 pfs, Mainstream: video H264, bitrate 2048 kbps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;During IP camera RTSP stream integration with development board we face following problem –&lt;/P&gt;&lt;P&gt;When ffmpeg library transcodes the input video from rtsp stream using default /specific options, cpu utilization is very high and resulting video stream has lag and missing frames.&lt;/P&gt;&lt;P&gt;The performance is optimum when no video transcoding happens and input stream is copied as is from the input.&lt;/P&gt;&lt;P&gt;The above conclusion can be inferred from following results -&lt;/P&gt;&lt;P&gt;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&lt;BR /&gt;[following commands were executed on the target board to record 15s of video from the IP camera using FFMPEG library (binaries)]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;1080p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.264&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out11.mp4&lt;/P&gt;&lt;P&gt;Execution time - 47.43s&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CPU Utilisation - ~60-70%&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;h264&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s out12.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.516s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;1080p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.265&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out21.mp4&lt;/P&gt;&lt;P&gt;Execution time - 46.58s&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CPU Utilisation - ~60-70%&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;hevc&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s ~/sample_ipcam_vid/out22.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.483s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Ip cam settings:&lt;/P&gt;&lt;P&gt;Res - &lt;STRONG&gt;720p&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Compression - &lt;STRONG&gt;h.264&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 1 - time ffmpeg -i rtsp://admin:123456@192.168.0.123:554/videoMain -t 15s out31.mp4&lt;/P&gt;&lt;P&gt;Execution time - 24.516s&lt;/P&gt;&lt;P&gt;[Missed Frames]&lt;BR /&gt;CPU Utilisation - ~60-70%&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Command 2 - time ffmpeg -c:v &lt;STRONG&gt;h264&lt;/STRONG&gt; -i rtsp://admin:123456@192.168.0.123/videoMain -c:v copy -t 15s ~/sample_ipcam_vid/out32.mp4&lt;/P&gt;&lt;P&gt;Execution time - 15.494s&lt;/P&gt;&lt;P&gt;CPU Utilisation - ~5-10%&lt;BR /&gt;&lt;BR /&gt;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&lt;/P&gt;&lt;P&gt;Similar performance is observed when using pre-saved local video file as input - thus ruling out bottlenecks caused due to network infrastructure&lt;/P&gt;&lt;P&gt;also, similar performance/lag is observed when reading video frames from opencv-python (both when input is ip camera url or saved local video file)&lt;/P&gt;&lt;P&gt;Python line -&lt;/P&gt;&lt;P&gt;&lt;EM&gt;video = cv2.VideoCapture(camUrl)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The performance doesn’t much vary when resolution/compression settings are changed in th eIP camera settings.&lt;/P&gt;&lt;P&gt;Desired performance – (to achieve live streaming, recording and ComputerVision applications)&lt;BR /&gt;CPU utilisation – as low as possible&lt;BR /&gt;Execution time –&amp;nbsp; around 1x (i.e. approx 15s for 15s Stream)&lt;/P&gt;&lt;P&gt;Kindly suggest how we can optimized same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 11:27:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/8MMINILPD4-EVK-rtsp-stream-slow-processing/m-p/1459981#M190529</guid>
      <dc:creator>ashish_m</dc:creator>
      <dc:date>2022-05-18T11:27:34Z</dc:date>
    </item>
  </channel>
</rss>

