{"id":359,"date":"2011-02-23T21:24:00","date_gmt":"2011-02-23T21:24:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/xuggler-tutorial-frames-capture-and-video-creation.html"},"modified":"2012-10-21T19:34:56","modified_gmt":"2012-10-21T19:34:56","slug":"xuggler-tutorial-frames-capture-video","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html","title":{"rendered":"Xuggler Tutorial: Frames Capture and Video Creation"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\"><i><strong>Note:<\/strong> This is part of our \u201c<a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-development-tutorials.html\">Xuggler Development Tutorials<\/a>\u201d series.<\/i><\/p>\n<p>So far in our Xuggler tutorials series we have performed an <a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/introduction-xuggler-video-manipulation.html\">Introduction to Xuggler for Video Manipulation<\/a> and we have discussed <a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-transcoding-media.html\">Transcoding and Media Modification<\/a>. In this tutorial, we shall see how to decode video and capture frames, as well as how to create video from scratch.<\/p>\n<p>Let&#8217;s begin with decoding a video stream and capturing some frames at predefined time intervals. This can be used, for example, in order to <a href=\"http:\/\/wiki.xuggle.com\/MediaTool_Introduction#How_To_Make_Thumbnails_Of_A_Media_File\">make thumbnails of a media file<\/a>. For this purpose, we will use again the <a href=\"http:\/\/wiki.xuggle.com\/MediaTool_Introduction\">MediaTool API<\/a>, a high-level API for decoding, encoding and modifying video. <\/p>\n<p>The concept is to open the media file, loop through a specific video stream and at specific intervals capture the corresponding frame, convert it to an image and dump the binary contents into a file. Here is what the code for all these looks like:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xuggler;\r\n\r\nimport java.awt.image.BufferedImage;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport javax.imageio.ImageIO;\r\n\r\nimport com.xuggle.mediatool.IMediaReader;\r\nimport com.xuggle.mediatool.MediaListenerAdapter;\r\nimport com.xuggle.mediatool.ToolFactory;\r\nimport com.xuggle.mediatool.event.IVideoPictureEvent;\r\nimport com.xuggle.xuggler.Global;\r\n\r\npublic class VideoThumbnailsExample {\r\n    \r\n    public static final double SECONDS_BETWEEN_FRAMES = 10;\r\n\r\n    private static final String inputFilename = \"c:\/Java_is_Everywhere.mp4\";\r\n    private static final String outputFilePrefix = \"c:\/snapshots\/mysnapshot\";\r\n    \r\n    \/\/ The video stream index, used to ensure we display frames from one and\r\n    \/\/ only one video stream from the media container.\r\n    private static int mVideoStreamIndex = -1;\r\n    \r\n    \/\/ Time of last frame write\r\n    private static long mLastPtsWrite = Global.NO_PTS;\r\n    \r\n    public static final long MICRO_SECONDS_BETWEEN_FRAMES = \r\n        (long)(Global.DEFAULT_PTS_PER_SECOND * SECONDS_BETWEEN_FRAMES);\r\n\r\n    public static void main(String[] args) {\r\n\r\n        IMediaReader mediaReader = ToolFactory.makeReader(inputFilename);\r\n\r\n        \/\/ stipulate that we want BufferedImages created in BGR 24bit color space\r\n        mediaReader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);\r\n        \r\n        mediaReader.addListener(new ImageSnapListener());\r\n\r\n        \/\/ read out the contents of the media file and\r\n        \/\/ dispatch events to the attached listener\r\n        while (mediaReader.readPacket() == null) ;\r\n\r\n    }\r\n\r\n    private static class ImageSnapListener extends MediaListenerAdapter {\r\n\r\n        public void onVideoPicture(IVideoPictureEvent event) {\r\n\r\n            if (event.getStreamIndex() != mVideoStreamIndex) {\r\n                \/\/ if the selected video stream id is not yet set, go ahead an\r\n                \/\/ select this lucky video stream\r\n                if (mVideoStreamIndex == -1)\r\n                    mVideoStreamIndex = event.getStreamIndex();\r\n                \/\/ no need to show frames from this video stream\r\n                else\r\n                    return;\r\n            }\r\n\r\n            \/\/ if uninitialized, back date mLastPtsWrite to get the very first frame\r\n            if (mLastPtsWrite == Global.NO_PTS)\r\n                mLastPtsWrite = event.getTimeStamp() - MICRO_SECONDS_BETWEEN_FRAMES;\r\n\r\n            \/\/ if it's time to write the next frame\r\n            if (event.getTimeStamp() - mLastPtsWrite &gt;= \r\n                    MICRO_SECONDS_BETWEEN_FRAMES) {\r\n                                \r\n                String outputFilename = dumpImageToFile(event.getImage());\r\n\r\n                \/\/ indicate file written\r\n                double seconds = ((double) event.getTimeStamp()) \/ \r\n                    Global.DEFAULT_PTS_PER_SECOND;\r\n                System.out.printf(\r\n                        \"at elapsed time of %6.3f seconds wrote: %s\\n\",\r\n                        seconds, outputFilename);\r\n\r\n                \/\/ update last write time\r\n                mLastPtsWrite += MICRO_SECONDS_BETWEEN_FRAMES;\r\n            }\r\n\r\n        }\r\n        \r\n        private String dumpImageToFile(BufferedImage image) {\r\n            try {\r\n                String outputFilename = outputFilePrefix + \r\n                     System.currentTimeMillis() + \".png\";\r\n                ImageIO.write(image, \"png\", new File(outputFilename));\r\n                return outputFilename;\r\n            } \r\n            catch (IOException e) {\r\n                e.printStackTrace();\r\n                return null;\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>This might seem a bit overwhelming, but it is really quite straightforward. Let me provide some details for you. We start by creating an <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaReader.html\">IMediaReader<\/a> from an input file. The media reader is used to read and decode media. Since we wish to manipulate the captures video frames as images, we use the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaReader.html#setBufferedImageTypeToGenerate%28int%29\">setBufferedImageTypeToGenerate<\/a> method to denote this. The reader opens up a media container, reads packets from it, decodes the data, and then dispatches information about the data to any registered <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaListener.html\">IMediaListener<\/a> objects. Here is where our custom class, ImageSnapListener, comes into play.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Our listener extends the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/MediaListenerAdapter.html\">MediaListenerAdapter<\/a>, which is an adapter (provides empty methods) implementing the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaListener.html\">IMediaListener<\/a> interface. Objects that implement this interface are notified about events generated during the video processing. We only care about handling video events, thus we only implement the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaListener.html#onVideoPicture%28com.xuggle.mediatool.event.IVideoPictureEvent%29\">IMediaListener.onVideoPicture<\/a> method. Inside that we use the provided <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/event\/IVideoPictureEvent.html\">IVideoPictureEvent<\/a> object to find what stream (video only) we are dealing with.<\/p>\n<p>Since we wish to capture frames in specific times, we have to mess a little with timestamps. First, we make sure we handle the very first frame by checking against the value of the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/xuggler\/Global.html#NO_PTS\">Global.NO_PTS<\/a> constant, which is a value that means no time stamp is set for a given object. Then, if the minimum elapsed time has passes, we capture the frame by invoking the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/event\/IVideoPictureEvent.html#getImage%28%29\">IVideoPictureEvent.getImage<\/a> method, which returns the underlying <a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/java\/awt\/image\/BufferedImage.html\">BufferedImage<\/a>. Note that we are talking about elapsed video time and not \u201creal time\u201d. We then dump the image data to a file in PNG format using the <a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/javax\/imageio\/ImageIO.html#write%28java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File%29\">ImageIO.write<\/a> utility method. Finally, we update the last write time.<\/p>\n<p>Let&#8217;s run this application in order to see the results. As input file, I am using an old Sun commercial proclaiming that \u201c<a href=\"http:\/\/www.youtube.com\/watch?v=SRLU1bJSLVg\">Java is Everywhere<\/a>\u201d. I have downloaded locally the MP4 version provided. Here is what the output console will look like:<\/p>\n<p><span style=\"font-style: italic\">at elapsed time of  0.000 seconds wrote: c:\/snapshots\/mysnapshot1298228503292.png<br \/>\nat elapsed time of 10.010 seconds wrote: c:\/snapshots\/mysnapshot1298228504014.png<br \/>\nat elapsed time of 20.020 seconds wrote: c:\/snapshots\/mysnapshot1298228504463.png<br \/>\n\u2026<br \/>\nat elapsed time of 130.063 seconds wrote: c:\/snapshots\/mysnapshot1298228509454.png<br \/>\nat elapsed time of 140.007 seconds wrote: c:\/snapshots\/mysnapshot1298228509933.png<br \/>\nat elapsed time of 150.017 seconds wrote: c:\/snapshots\/mysnapshot1298228510379.png<\/span><\/p>\n<p>The total video time is about 151 seconds so we capture 16 frames. Here is what the captured images look like in my folder:<\/p>\n<p><a href=\"http:\/\/1.bp.blogspot.com\/-bNPm2VinAXY\/TWGBejWrjAI\/AAAAAAAAAAk\/L_qpiIulJi8\/s1600\/01-thumbnails.png\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/1.bp.blogspot.com\/-bNPm2VinAXY\/TWGBejWrjAI\/AAAAAAAAAAk\/L_qpiIulJi8\/s320\/01-thumbnails.png\" style=\"cursor: pointer;height: 150px;margin: 0px auto 10px;text-align: center;width: 320px\" \/><\/a><\/p>\n<p>OK, that&#8217;s about it for making video thumbnails. Let&#8217;s now see how to create a video from scratch. As input, we will use <a href=\"http:\/\/wiki.xuggle.com\/MediaTool_Introduction#How_To_Take_Snapshots_Of_Your_Desktop\">sequential snapshots from our desktop<\/a>. This can be used for a rudimentary screen recording application.<\/p>\n<p>In order to create video, we will have to take a bit more low level approach in comparison to the <a href=\"http:\/\/wiki.xuggle.com\/MediaTool_Introduction\">MediaTool API<\/a> that we have seen so far. Don&#8217;t worry though, it is not going to be complicated. The main idea is that we create a media writer, add some stream information to it, encode our media (the screenshot images), and close the writer. Let&#8217;s see the code used to achieve this:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.xuggler;\r\n\r\nimport java.awt.AWTException;\r\nimport java.awt.Dimension;\r\nimport java.awt.Rectangle;\r\nimport java.awt.Robot;\r\nimport java.awt.Toolkit;\r\nimport java.awt.image.BufferedImage;\r\nimport java.util.concurrent.TimeUnit;\r\n\r\nimport com.xuggle.mediatool.IMediaWriter;\r\nimport com.xuggle.mediatool.ToolFactory;\r\nimport com.xuggle.xuggler.ICodec;\r\n\r\npublic class ScreenRecordingExample {\r\n    \r\n    private static final double FRAME_RATE = 50;\r\n    \r\n    private static final int SECONDS_TO_RUN_FOR = 20;\r\n    \r\n    private static final String outputFilename = \"c:\/mydesktop.mp4\";\r\n    \r\n    private static Dimension screenBounds;\r\n\r\n    public static void main(String[] args) {\r\n\r\n        \/\/ let's make a IMediaWriter to write the file.\r\n        final IMediaWriter writer = ToolFactory.makeWriter(outputFilename);\r\n        \r\n        screenBounds = Toolkit.getDefaultToolkit().getScreenSize();\r\n\r\n        \/\/ We tell it we're going to add one video stream, with id 0,\r\n        \/\/ at position 0, and that it will have a fixed frame rate of FRAME_RATE.\r\n        writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_MPEG4, \r\n                   screenBounds.width\/2, screenBounds.height\/2);\r\n\r\n        long startTime = System.nanoTime();\r\n        \r\n        for (int index = 0; index &lt; SECONDS_TO_RUN_FOR * FRAME_RATE; index++) {\r\n            \r\n            \/\/ take the screen shot\r\n            BufferedImage screen = getDesktopScreenshot();\r\n\r\n            \/\/ convert to the right image type\r\n            BufferedImage bgrScreen = convertToType(screen, \r\n                   BufferedImage.TYPE_3BYTE_BGR);\r\n\r\n            \/\/ encode the image to stream #0\r\n            writer.encodeVideo(0, bgrScreen, System.nanoTime() - startTime, \r\n                   TimeUnit.NANOSECONDS);\r\n\r\n            \/\/ sleep for frame rate milliseconds\r\n            try {\r\n                Thread.sleep((long) (1000 \/ FRAME_RATE));\r\n            } \r\n            catch (InterruptedException e) {\r\n                \/\/ ignore\r\n            }\r\n            \r\n        }\r\n        \r\n        \/\/ tell the writer to close and write the trailer if  needed\r\n        writer.close();\r\n\r\n    }\r\n    \r\n    public static BufferedImage convertToType(BufferedImage sourceImage, int targetType) {\r\n        \r\n        BufferedImage image;\r\n\r\n        \/\/ if the source image is already the target type, return the source image\r\n        if (sourceImage.getType() == targetType) {\r\n            image = sourceImage;\r\n        }\r\n        \/\/ otherwise create a new image of the target type and draw the new image\r\n        else {\r\n            image = new BufferedImage(sourceImage.getWidth(), \r\n                 sourceImage.getHeight(), targetType);\r\n            image.getGraphics().drawImage(sourceImage, 0, 0, null);\r\n        }\r\n\r\n        return image;\r\n        \r\n    }\r\n    \r\n    private static BufferedImage getDesktopScreenshot() {\r\n        try {\r\n            Robot robot = new Robot();\r\n            Rectangle captureSize = new Rectangle(screenBounds);\r\n            return robot.createScreenCapture(captureSize);\r\n        } \r\n        catch (AWTException e) {\r\n            e.printStackTrace();\r\n            return null;\r\n        }\r\n        \r\n    }\r\n\r\n}\r\n<\/pre>\n<p>We start by creating an <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaWriter.html\">IMediaWriter<\/a> from a given output file. This class encodes and decodes media, handling both audio and video streams. Xuggler guesses the output format from the file name extension (in our case MP4) and sets some default values appropriately. We then use the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaWriter.html#addVideoStream%28int,%20int,%20com.xuggle.xuggler.ICodec.ID,%20int,%20int%29\">addVideoStream<\/a> method to add a new video stream, providing its index, the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Video_encoder\">codec type<\/a> used (<a href=\"http:\/\/en.wikipedia.org\/wiki\/MPEG-4\">MPEG-4<\/a> here) and the video dimensions. The dimensions are set equal to half of the screen&#8217;s dimensions in this example.<\/p>\n<p>Then we execute a loop that runs for a number of times equal to the desired frame rate multiplied with the desired running time. Inside the loop, we generate a screen snapshot as described in the <a href=\"http:\/\/www.javalobby.org\/forums\/thread.jspa?threadID=16400&amp;tstart=0\">Java2D: Screenshots with Java<\/a> article. We retrieve the screenshot as a <a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/java\/awt\/image\/BufferedImage.html\">BufferedImage<\/a> and convert it to the appropriate type (<a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/java\/awt\/image\/BufferedImage.html#TYPE_3BYTE_BGR\">TYPE_3BYTE_BGR<\/a>) if it is not already there.<\/p>\n<p>Next, we encode the image to the video stream using the <a href=\"http:\/\/build.xuggle.com\/view\/Stable\/job\/xuggler_jdk5_stable\/javadoc\/java\/api\/com\/xuggle\/mediatool\/IMediaWriter.html#encodeVideo%28int,%20java.awt.image.BufferedImage,%20long,%20java.util.concurrent.TimeUnit%29\">IMediaWriter.encodeVideo<\/a> method. We provide the stream index, the image, the elapsed video time and the time unit. Then, we sleep for the appropriate number of time, depending on the desired frame rate. When the loop is over, we close the writer and write the trailer if necessary, depending on the video format (this is done automatically by Xuggler).<\/p>\n<p>If we execute the application, a video will be created which has recorded your desktop actions. Here  is a still image of mine while browsing the <a href=\"http:\/\/www.javacodegeeks.com\/\">JavaCodeGeeks<\/a> site:<\/p>\n<p><a href=\"http:\/\/3.bp.blogspot.com\/-6pcc1txXPvg\/TWGBpT5aRcI\/AAAAAAAAAAs\/6Ebv0Lg69_w\/s1600\/02-video-creation.png\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-6pcc1txXPvg\/TWGBpT5aRcI\/AAAAAAAAAAs\/6Ebv0Lg69_w\/s320\/02-video-creation.png\" style=\"cursor: pointer;height: 241px;margin: 0px auto 10px;text-align: center;width: 320px\" \/><\/a><\/p>\n<p>That&#8217;s it guys, yet another Xuggler tutorial describing how to capture video frames from an input file and how to generate video using desktop snapshots. As always, you can <a href=\"http:\/\/dl.dropbox.com\/u\/7215751\/JavaCodeGeeks\/XugglerFramesCaptureVideoCreationTutorial\/XugglerTutorialProject_Part03.zip\">download the Eclipse project<\/a> created for this tutorial. Stay tuned for more Xuggler tutorials here at <a href=\"http:\/\/www.javacodegeeks.com\/\">JavaCodeGeeks<\/a>! And don&#8217;t forget to share!<\/p>\n<p><strong>Related Articles:<\/strong><\/p>\n<ul style=\"text-align: left\">\n<li> <a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/introduction-xuggler-video-manipulation.html\">Introduction to Xuggler for Video Manipulation<\/a><\/li>\n<li> <a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-transcoding-media.html\">Xuggler Tutorial: Transcoding and Media Modification<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/05\/rtmp-to-rtsp-re-stream-using-wowza-and.html\">RTMP To RTSP re-stream using wowza and xuggler<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for Video Manipulation and we have discussed Transcoding and Media Modification. In this tutorial, we shall see how to decode video and capture frames, as well as how to create video &hellip;<\/p>\n","protected":false},"author":3,"featured_media":255,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[40],"class_list":["post-359","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desktop-java","tag-xuggler"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-02-23T21:24:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T19:34:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ilias Tsagklis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ilias Tsagklis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9a83496b285d30c61e8a674625c1350e\"},\"headline\":\"Xuggler Tutorial: Frames Capture and Video Creation\",\"datePublished\":\"2011-02-23T21:24:00+00:00\",\"dateModified\":\"2012-10-21T19:34:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html\"},\"wordCount\":990,\"commentCount\":46,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/xuggler-logo.jpg\",\"keywords\":[\"Xuggler\"],\"articleSection\":[\"Desktop Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html\",\"name\":\"Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/xuggler-logo.jpg\",\"datePublished\":\"2011-02-23T21:24:00+00:00\",\"dateModified\":\"2012-10-21T19:34:56+00:00\",\"description\":\"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/xuggler-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/xuggler-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/02\\\/xuggler-tutorial-frames-capture-video.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Desktop Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/desktop-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Xuggler Tutorial: Frames Capture and Video Creation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9a83496b285d30c61e8a674625c1350e\",\"name\":\"Ilias Tsagklis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g\",\"caption\":\"Ilias Tsagklis\"},\"description\":\"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"http:\\\/\\\/www.iliastsagklis.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/iliastsagklis\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/ilias-tsagklis\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks","description":"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html","og_locale":"en_US","og_type":"article","og_title":"Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks","og_description":"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for","og_url":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-02-23T21:24:00+00:00","article_modified_time":"2012-10-21T19:34:56+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg","type":"image\/jpeg"}],"author":"Ilias Tsagklis","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ilias Tsagklis","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9a83496b285d30c61e8a674625c1350e"},"headline":"Xuggler Tutorial: Frames Capture and Video Creation","datePublished":"2011-02-23T21:24:00+00:00","dateModified":"2012-10-21T19:34:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html"},"wordCount":990,"commentCount":46,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg","keywords":["Xuggler"],"articleSection":["Desktop Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html","url":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html","name":"Xuggler Tutorial: Frames Capture and Video Creation - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg","datePublished":"2011-02-23T21:24:00+00:00","dateModified":"2012-10-21T19:34:56+00:00","description":"Note: This is part of our \u201cXuggler Development Tutorials\u201d series. So far in our Xuggler tutorials series we have performed an Introduction to Xuggler for","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/xuggler-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/02\/xuggler-tutorial-frames-capture-video.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Desktop Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/desktop-java"},{"@type":"ListItem","position":4,"name":"Xuggler Tutorial: Frames Capture and Video Creation"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9a83496b285d30c61e8a674625c1350e","name":"Ilias Tsagklis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/43505f28bb49f6e290c24be0b209ccc1af350f0f6587025ffd4847ef44bf6b78?s=96&d=mm&r=g","caption":"Ilias Tsagklis"},"description":"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.","sameAs":["http:\/\/www.iliastsagklis.com\/","https:\/\/www.linkedin.com\/in\/iliastsagklis"],"url":"https:\/\/www.javacodegeeks.com\/author\/ilias-tsagklis"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/255"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}