{"action":"created","issue":{"url":"https://api.github.com/repos/openimaj/openimaj/issues/63","labels_url":"https://api.github.com/repos/openimaj/openimaj/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/openimaj/openimaj/issues/63/comments","events_url":"https://api.github.com/repos/openimaj/openimaj/issues/63/events","html_url":"https://github.com/openimaj/openimaj/issues/63","id":58967503,"number":63,"title":"VideoShotDetector(s) crash on longer videos","user":{"login":"jonhare","id":1141847,"avatar_url":"https://avatars.githubusercontent.com/u/1141847?v=3","gravatar_id":"","url":"https://api.github.com/users/jonhare","html_url":"https://github.com/jonhare","followers_url":"https://api.github.com/users/jonhare/followers","following_url":"https://api.github.com/users/jonhare/following{/other_user}","gists_url":"https://api.github.com/users/jonhare/gists{/gist_id}","starred_url":"https://api.github.com/users/jonhare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonhare/subscriptions","organizations_url":"https://api.github.com/users/jonhare/orgs","repos_url":"https://api.github.com/users/jonhare/repos","events_url":"https://api.github.com/users/jonhare/events{/privacy}","received_events_url":"https://api.github.com/users/jonhare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sinjax","id":52549,"avatar_url":"https://avatars.githubusercontent.com/u/52549?v=3","gravatar_id":"","url":"https://api.github.com/users/sinjax","html_url":"https://github.com/sinjax","followers_url":"https://api.github.com/users/sinjax/followers","following_url":"https://api.github.com/users/sinjax/following{/other_user}","gists_url":"https://api.github.com/users/sinjax/gists{/gist_id}","starred_url":"https://api.github.com/users/sinjax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinjax/subscriptions","organizations_url":"https://api.github.com/users/sinjax/orgs","repos_url":"https://api.github.com/users/sinjax/repos","events_url":"https://api.github.com/users/sinjax/events{/privacy}","received_events_url":"https://api.github.com/users/sinjax/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-02-25T20:51:50Z","updated_at":"2015-02-25T20:51:52Z","closed_at":null,"body":"OP-64: Hi,\n\nI'm trying to execute the video boundary detection demos. I tried the HistogramVideoShotDetector and the LocalVideoShotDetector, however they both crash at longer videos. My machines has 16 gigs of RAM and the JVM gets most of it. After a couple of shots, depending on the algorithm, I get a \"java.lang.OutOfMemoryError\". I tried to fix it myself, even went so far as to define my own VideoShotDetector, but I guess the problem lies deeper in the framework. I'd be really happy if someone that knows the codebase better could give me a tip on how to fix it, or could look into it.\nThe error message I get, running the VideoShotDetectorVisualisation.java on a 40 minute video is: \n\nException in thread \"main\" java.lang.OutOfMemoryError: Java heap space\n\tat org.openimaj.image.FImage.<init>(FImage.java:121)\n\tat org.openimaj.image.FImage.clone(FImage.java:388)\n\tat org.openimaj.image.FImage.clone(FImage.java:58)\n\tat org.openimaj.image.MultiBandImage.clone(MultiBandImage.java:341)\n\tat org.openimaj.image.MultiBandImage.clone(MultiBandImage.java:52)\n\tat org.openimaj.video.processing.shotdetector.VideoKeyframe.clone(VideoKeyframe.java:93)\n\tat org.openimaj.video.processing.shotdetector.VideoShotDetector.checkForShotBoundary(VideoShotDetector.java:310)\n\tat org.openimaj.video.processing.shotdetector.VideoShotDetector.processFrame(VideoShotDetector.java:436)\n\tat org.openimaj.video.processor.VideoProcessor.process(VideoProcessor.java:131)\n\tat org.openimaj.video.processing.shotdetector.VideoShotDetector.process(VideoShotDetector.java:184)\n\tat org.openimaj.demos.video.VideoShotDetectorVisualisation.main(VideoShotDetectorVisualisation.java:177)\n16:27:04.786 [Finalizer] DEBUG com.xuggle.xuggler - Closing dangling Container (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:146)\n16:27:04.789 [Finalizer] DEBUG com.xuggle.xuggler - Closing dangling StreamCoder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:96)\n16:27:04.789 [Finalizer] DEBUG com.xuggle.xuggler - Closing dangling StreamCoder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:96)"},"comment":{"url":"https://api.github.com/repos/openimaj/openimaj/issues/comments/76053939","html_url":"https://github.com/openimaj/openimaj/issues/63#issuecomment-76053939","issue_url":"https://api.github.com/repos/openimaj/openimaj/issues/63","id":76053939,"user":{"login":"jonhare","id":1141847,"avatar_url":"https://avatars.githubusercontent.com/u/1141847?v=3","gravatar_id":"","url":"https://api.github.com/users/jonhare","html_url":"https://github.com/jonhare","followers_url":"https://api.github.com/users/jonhare/followers","following_url":"https://api.github.com/users/jonhare/following{/other_user}","gists_url":"https://api.github.com/users/jonhare/gists{/gist_id}","starred_url":"https://api.github.com/users/jonhare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonhare/subscriptions","organizations_url":"https://api.github.com/users/jonhare/orgs","repos_url":"https://api.github.com/users/jonhare/repos","events_url":"https://api.github.com/users/jonhare/events{/privacy}","received_events_url":"https://api.github.com/users/jonhare/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T20:51:52Z","updated_at":"2015-02-25T20:51:52Z","body":"davedupplaw:  The VideoShotDetector stores all the keyframes it finds in a list in memory (by default). That might become a pretty big memory hog on a large video.  You can turn that off with VideoShotDetector#setFindKeyFrames(boolean).  It will then only store the position in the video at which the shot boundary was detected and not the frame itself.  If you want to store the frames somewhere, you can add a ShotDetectedListener using VideoShotDetector#addShotDetectedListener(ShotDetectedListener) that is called each time a new shot boundary is found during processing.  The VideoKeyFrame that's passed in the event will not have the frame in it if findKeyFrames is false. So you will need to use Video#getCurrentFrame() to get the current frame. That's the workaround for now. I will probably rearrange the VideoShotDetector code so that it will pass the keyframe in that event but won't store it if findKeyFrames is false."}}