Hello @ndessart, hello everyone else,
as I described in the first part of my forum contribution, I had some problems with yuv_frame.ref() filling up my computer’s RAM.
Now that I’m back at university working on my project, I’ve been looking into this issue again.
I experimented with my Python program and came to the conclusion that it must have something to do with the .unref() function. I searched for it in Olympe and found it under ‘olympe/video/frame.py’.
def unref(self):
“”"
This function decrements the reference counter of the
underlying buffer(s)
“”"
try:
if self._stream[“frame_type”] == od.VDEF_FRAME_TYPE_CODED and (
self._frame_pointer
):
res = od.mbuf_coded_video_frame_release_packed_buffer(
self._mbuf_video_frame, self._frame_pointer
)
if res != 0:
self.logger.error(
“mbuf_coded_video_frame_release_packed_buffer "
f”{self._media_id}: {os.strerror(-res)}"
)
res = self._mbuf.unref(self._mbuf_video_frame)
if res != 0:
self.logger.error(
f"mbuf_unref unpacked frame error {self._media_id}: "
f"{os.strerror(-res)}"
)
finally:
if self._packed_video_frame:
res = self._mbuf.unref(self._packed_video_frame)
if res != 0:
self.logger.error(
f"mbuf_unref packed frame error {self._media_id} "
f"{os.strerror(-res)}"
)
After trying to understand what happens in this function, I came to the conclusion that it could possibly be that in the current Olympe version only the H264 encoded stream is dereferenced correctly. I then tried using the H264 encoded stream (callback is h264_cb) instead of the raw data (raw_cb). I noticed that the RAM does not fill up anymore.
Now I wanted to inquire if this could be the solution to the problem.
Alternatively, if this is not the solution, I would be very grateful for help decoding the H264 stream.
I have already tried a version with scikit video, PyAv and ffmpeg. The problem is that these modules all only accept a file path and not a numpy array or the byte encoded version of the numpy array.
With kind regards
Basti