Iterating 4K GoPro video using python API, results in huge memory leaks and process killed
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
I am doing basic usage: instantiate reader, read frames, skip frames. 5 minutes into the video, process memory allocation is already at 5GB. By minute 10 it goes up to 14GB. ImageIO needs less than 100MB for the same file (with 30% slower performance)
class DecordVideoIterator:
def __init__( self, videoPathName ):
self.videoReader = VideoReader( videoPathName, ctx = cpu(0) )
self.currentIndex = 0
def ReadNextFrame( self ):
gc.collect()
nextFrame = self.videoReader.next().asnumpy()
self.currentIndex += 1
return nextFrame
def SkipFrames( self, count ):
self.videoReader.skip_frames( count )
self.currentIndex += count
def CurrentIndex( self ):
return self.currentIndex
Substituting this iterator with ImageIO python library, everything works fine. Object tracker and tracemalloc shows no Python leaks that I coudl identify. Leaks must be in the native code.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.