{"action":"created","issue":{"url":"https://api.github.com/repos/bytedeco/javacv/issues/946","repository_url":"https://api.github.com/repos/bytedeco/javacv","labels_url":"https://api.github.com/repos/bytedeco/javacv/issues/946/labels{/name}","comments_url":"https://api.github.com/repos/bytedeco/javacv/issues/946/comments","events_url":"https://api.github.com/repos/bytedeco/javacv/issues/946/events","html_url":"https://github.com/bytedeco/javacv/issues/946","id":308352106,"number":946,"title":"Frame Grabber is Crashing for Corrupt Videos. ","user":{"login":"AKMANSoft","id":21236130,"avatar_url":"https://avatars2.githubusercontent.com/u/21236130?v=4","gravatar_id":"","url":"https://api.github.com/users/AKMANSoft","html_url":"https://github.com/AKMANSoft","followers_url":"https://api.github.com/users/AKMANSoft/followers","following_url":"https://api.github.com/users/AKMANSoft/following{/other_user}","gists_url":"https://api.github.com/users/AKMANSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/AKMANSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AKMANSoft/subscriptions","organizations_url":"https://api.github.com/users/AKMANSoft/orgs","repos_url":"https://api.github.com/users/AKMANSoft/repos","events_url":"https://api.github.com/users/AKMANSoft/events{/privacy}","received_events_url":"https://api.github.com/users/AKMANSoft/received_events","type":"User","site_admin":false},"labels":[{"id":93998514,"url":"https://api.github.com/repos/bytedeco/javacv/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2018-03-25T14:00:25Z","updated_at":"2018-05-10T10:41:58Z","closed_at":"2018-05-10T10:41:58Z","author_association":"NONE","body":"Hi \r\n\r\nI have a corrupt video, which is crashing my application, when capture frame from Frame Grabber. \r\n\r\nSample Code: \r\n\r\n`import java.awt.image.BufferedImage;\r\nimport java.io.File;\r\n\r\nimport org.bytedeco.javacpp.avutil;\r\nimport org.bytedeco.javacv.FFmpegFrameGrabber;\r\nimport org.bytedeco.javacv.Frame;\r\nimport org.bytedeco.javacv.FrameGrabber.Exception;\r\nimport org.bytedeco.javacv.Java2DFrameConverter;\r\n\r\nimport com.msv.model.Video;\r\n\r\npublic class CaptureFrames {\r\n\r\n\tpublic CaptureFrames() {\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic static BufferedImage captureFrame(File video) throws Exception {\r\n\t\treturn captureFrame(video, 1l);\r\n\t}\r\n\t\r\n\tpublic static BufferedImage captureFrame(File video, long time) throws Exception{\r\n\t\t\r\n\t\tBufferedImage convertedImage = null;\r\n\t\t\r\n\t\tavutil.av_log_set_level(avutil.AV_LOG_QUIET);\r\n\t\t\r\n\t\tFFmpegFrameGrabber grabber = new FFmpegFrameGrabber(video);\r\n\t\t\r\n\t\tgrabber.setOption(\"max_nal_size\", \"1024\");\r\n\t\t\r\n\t\tJava2DFrameConverter converter = new Java2DFrameConverter();\r\n\t\t\r\n\t\tgrabber.start();\r\n\t\t\r\n\t\tgrabber.setTimestamp(time * 1000);\r\n\t\t\r\n        Frame frame = null;\r\n        frame = grabber.grabFrame(false,true,true,false);\r\n        \r\n       // long totalTime = grabber.getLengthInTime();\r\n        \r\n        //System.err.println(\"total time is \"+totalTime/ 1000000);\r\n        \r\n        if (frame != null && frame.image != null && frame.imageChannels!= 0) {\r\n\t\t\tif (converter.convert(frame) == null)\r\n\t\t\t\treturn convertedImage;\r\n\t\t\tconvertedImage = converter.convert(frame);\r\n\t\t\t\r\n\t\t\treturn convertedImage;\r\n\r\n\t\t}\r\n        \r\n        grabber.stop();\r\n        \r\n        return convertedImage;\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\ttry {\r\n\t\t\tCaptureFrames.captureFrame(new File(\"C:\\\\Users\\\\Admin\\\\Desktop\\\\CorruptVids\\\\_carved_019259.flv\"));\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nCorrupt Video: \r\nAttachment is a corrupt video, which is zip. \r\n\r\n[_carved_019259.zip](https://github.com/bytedeco/javacv/files/1845379/_carved_019259.zip)\r\n`\r\nCrash logs:\r\n[hs_err_pid4624.log](https://github.com/bytedeco/javacv/files/1845423/hs_err_pid4624.log)\r\n"},"comment":{"url":"https://api.github.com/repos/bytedeco/javacv/issues/comments/388018872","html_url":"https://github.com/bytedeco/javacv/issues/946#issuecomment-388018872","issue_url":"https://api.github.com/repos/bytedeco/javacv/issues/946","id":388018872,"user":{"login":"saudet","id":3328023,"avatar_url":"https://avatars1.githubusercontent.com/u/3328023?v=4","gravatar_id":"","url":"https://api.github.com/users/saudet","html_url":"https://github.com/saudet","followers_url":"https://api.github.com/users/saudet/followers","following_url":"https://api.github.com/users/saudet/following{/other_user}","gists_url":"https://api.github.com/users/saudet/gists{/gist_id}","starred_url":"https://api.github.com/users/saudet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saudet/subscriptions","organizations_url":"https://api.github.com/users/saudet/orgs","repos_url":"https://api.github.com/users/saudet/repos","events_url":"https://api.github.com/users/saudet/events{/privacy}","received_events_url":"https://api.github.com/users/saudet/received_events","type":"User","site_admin":false},"created_at":"2018-05-10T10:41:58Z","updated_at":"2018-05-10T10:41:58Z","author_association":"OWNER","body":"Duplicate of #991 "}}
{"actor":{"display_login":"saudet"}}