Is there a RAM efficient way to export a video?
5 views (last 30 days)
Show older comments
I have code that analyzes a video makes some markings on the video and then saves an output video.
I've saved the output video as frames using export graphics and then go back through those and save the video afterward.
The process of exporting the frames causes the RAM use to increase beyond what the computer has (32GB). This is true even when the video output video is much smaller in size than this.
Is there a way to export a video or frames that won't cause the ram use to increase indefinately?
(I've tried to clear variables related to the frames but that didn't seem to work. Maybe I didn't do it correctly)
0 Comments
Answers (1)
Walter Roberson
on 28 Apr 2022
If possible, instead of displaying the frames and drawing on them and using export graphics, try using Computer Vision Toolbox insertShape() and insertText() to draw onto an in-memory array, which you can then imwrite() to a file.
3 Comments
Walter Roberson
on 30 Apr 2022
You cannot imwrite() a displayed figure -- but you can imwrite() the data that you would have displayed in the figure (but that might involve using insertShape() or insertText() to draw on top of the data array.)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!