This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] SK-AM62A-LP:SK-AM62A-LP

Guru**** 2483955 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1552745/sk-am62a-lp-sk-am62a-lp

器件型号:SK-AM62A-LP


工具/软件:

大家好:  

我在做什么 ADAS 视频录制 在 AM62A 上具有两种保存模式:

  1. 基于事件 (由距离阈值或检测等因素触发)

  2. 基于环路 (连续录制,覆盖最旧的文件以保持有限的存储)

下面是 post_process.py 中 apps_python 的部分。 当前的文件大小约为 18MB、我希望为基于云的保存而减小文件大小。 解决方案是什么?  



  默认 save_event_video(自身,帧):
    尝试:
      如果不是帧:
        打印(“[PostProcessDetection]无要保存的帧。“)
        返回

      时间戳= datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
      out_path = os.path.join (self.output_dir、f“event_{timestamp}.avi“)
      高度、宽度=帧[0].shape[:2]

      Writer = CV2.VideoWriter (out_path、CV2.VideoWriter_fourcc (*'MJPG')、24、(宽度,高度))
      如果不是 writer.isOpened():
        Print (f“[error]无法为{out_path}“打开 VideoWriter)
        返回

      对于 i、f in enumerate (frames):
        如果 f 为无或 f.size == 0:
          打印 (f“[PostProcessDetection]跳过空帧{i}“)
          继续
        Writer.write (f)

      vwriter.release()
      打印 (f“[PostProcessDetection]事件视频已保存:{out_path}“)

    例外情况为 e:
      Print (f“[PostProcessDetection]错误保存视频:{e}“)
    最后:
      使用 self.record_lock:
        自我录音=假

  DEF LOOP_VIDEO_WORKER(自身):
    LOOP_INDEX = 0
    在 self.loop_recording 时:
      时间睡眠 (5)
      如果 len (self.frame_buffer)< 10:
        继续 #等待缓冲区有足够的帧

      frames = self.frame_buffer.copy ()
      out_path = os.path.join (self.output_dir、f“loop_{loop_index % 10}.avi“)  
      LOOP_INDEX += 1

      尝试:
        高度、宽度=帧[0].shape[:2]
        Writer = CV2.VideoWriter (out_path、CV2.VideoWriter_fourcc (*'MJPG')、24、(宽度,高度))  
        如果不是 writer.isOpened():
          Print(f“[Loop]无法为{out_path}“打开写入程序)
          继续

        写入= 0
        对于 i、f in enumerate (frames):
          如果 f 为无或 f.size == 0:
            打印 (f“[循环【循环】跳过空帧{i}“)
            继续
          Writer.write (f)
          写入+= 1

        vwriter.release()
        如果写入> 0:
          打印 (f“[循环【循环】已保存:{out_path}“)
        否则:
          OS.REMOVE (OUT_PATH)
          Print (f“[循环【循环】已删除空循环文件:{out_path}“)

      例外情况为 e:
        Print (f“[循环【循环】异常:{e}“