Explicit close of VideoReader
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
Hey there,
Thanks for the great project, it helped me gain lots of performance :)
I have a little feature request though, since I'm processing multiple mp4 files that I need to move around in my filesystem after I've read them:
```
for file in files:
vr = VideoReader(file)
# ... read and process the frames...
if success:
os.rename(file, other_path)
```
Now this fails on Windows, because the reader is having the file still open:
> PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
I could force the garbage collection (and thus the __delete__ handler) by using:
> del vr
But it would be much better if you could add the required functions to wrap the reader into a [with .. as block](https://docs.python.org/3/whatsnew/2.6.html#pep-343-the-with-statement) that will free the video handle.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.