How to record desktop with jmf?

Hi, i'm new using jmf, so if it's a simple issue i don't know :S
I'm trying to make an app that record the desktop. I have found this:
http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JVidCap.html
But when i run it:
"! No Devices for RGB, 160x120, FrameRate=15.0"
And a NullPointerException if i push "Start" button.
I tried to change the code, video formats, etc... but nothing successful happened. what's the problem? what's means these error and how to solve it?
Regards.

But... i'm not sure how to use it :PMake your own class.... I am posting this class (just for demo):
* This class uses custom DataSource given at Sun JMF solutions page:
* <a href="http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/ScreenGrabber.html">Screen Grabber</a>
* @author talha
public class ScreenCapture extends JFrame {
    Player p;
    public ScreenCapture() {
        super("Screen Capture");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        try {
            p = Manager.createRealizedPlayer(Manager.createDataSource(new MediaLocator("screen://0,0,640,480/10")));
        } catch (Exception ex) {
            Logger.getLogger(ScreenCapture.class.getName()).log(Level.SEVERE, null, ex);
        if(p.getVisualComponent()!=null)getContentPane().add(p.getVisualComponent());
        p.start();
        pack();
        setLocationRelativeTo(null);
    public static void main(String args[]){
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new ScreenCapture().setVisible(true);
With this can i read data? I suppose that i can write it to disk directly or not? (replace System.out with an OutpuStream) No, if you want to write the captured video to the disk, you would have to make a Processor and DataSink... if these terms sound new, then you would have to learn JMF. Writing the captured video to disk has been asked many times, my suggestion: search this forum.
Thanks!

Similar Messages

  • How to record sound with JMF?

    I just want to record a clip of sound and save it in a WAV file. I exhausted the web but just couldn't find a tutorial. Would someone be kind enough to give me a tutorial or a sample code? The simpler the better. Thanks.

    Hi there,
    The following lines of code will record sound for 5 sec and save it in file C:/test.wav.
    import java.io.IOException;
    import javax.media.CannotRealizeException;
    import javax.media.DataSink;
    import javax.media.Format;
    import javax.media.Manager;
    import javax.media.MediaLocator;
    import javax.media.NoDataSinkException;
    import javax.media.NoProcessorException;
    import javax.media.NotRealizedError;
    import javax.media.Processor;
    import javax.media.ProcessorModel;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.FileTypeDescriptor;
    public class WAVWriter {
         public void record(){
              AudioFormat format = new AudioFormat(AudioFormat.LINEAR, 44100, 16, 1);
              ProcessorModel model = new ProcessorModel(new Format[]{format}, new FileTypeDescriptor(FileTypeDescriptor.WAVE));
              try {
                   Processor processor = Manager.createRealizedProcessor(model);
                   DataSink sink = Manager.createDataSink(processor.getDataOutput(), new MediaLocator("file:///C:/test.wav"));
                   processor.start();
                   sink.open();
                   sink.start();
                   Thread.sleep(5000);
                   sink.stop();
                   sink.close();
                   processor.stop();
                   processor.close();
              } catch (NoProcessorException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (CannotRealizeException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (NoDataSinkException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (NotRealizedError e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         public static void main(String[] args) {
              new WAVWriter().record();
    }I hope this will help. Don't forget to go through JMF guide (http://www.cdt.luth.se/~johank/smd151/jmf/jmf2_0-guide.pdf), especially page 81... it's not always helpfull, but sometimes, it may give you some good answers.
    Happy coding!!!

  • How to record desktop

    hi, everyone
    I want to capture screen to video with jmf
    what should i do

    But... i'm not sure how to use it :PMake your own class.... I am posting this class (just for demo):
    * This class uses custom DataSource given at Sun JMF solutions page:
    * <a href="http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/ScreenGrabber.html">Screen Grabber</a>
    * @author talha
    public class ScreenCapture extends JFrame {
        Player p;
        public ScreenCapture() {
            super("Screen Capture");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            try {
                p = Manager.createRealizedPlayer(Manager.createDataSource(new MediaLocator("screen://0,0,640,480/10")));
            } catch (Exception ex) {
                Logger.getLogger(ScreenCapture.class.getName()).log(Level.SEVERE, null, ex);
            if(p.getVisualComponent()!=null)getContentPane().add(p.getVisualComponent());
            p.start();
            pack();
            setLocationRelativeTo(null);
        public static void main(String args[]){
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new ScreenCapture().setVisible(true);
    With this can i read data? I suppose that i can write it to disk directly or not? (replace System.out with an OutpuStream) No, if you want to write the captured video to the disk, you would have to make a Processor and DataSink... if these terms sound new, then you would have to learn JMF. Writing the captured video to disk has been asked many times, my suggestion: search this forum.
    Thanks!

  • How to use ffmpeg with jmf

    I am trying to use ffmpeg with jmf. Do any one have any idea how to do it.

    Get binary distro and follow Manual Installation section of http://fobs.sourceforge.net/f4jmf_first.html

  • How to hint movie with JMF

    Hello,
    I would like to know how to make hinted movies with JMf, but no One seem to talk about this in forums...
    Any idea ?

    Get binary distro and follow Manual Installation section of http://fobs.sourceforge.net/f4jmf_first.html

  • How to record video with a watermark logo in Adobe AIR app?

    I would like to develop an app in Adobe AIR. The requirement is that video recording with a custom watermark logo on top left. Anyone have any idea, how to record a video with custom watermark?
    Please suggest some code or any reference, it would be helpful for all who is looking video recording.
    Thanks!

    Yeah I'm developing video recording ANE. It allows you to record the whole AIR stage, including anything you've got there (video, movieclips on top, Stage3D or whatever): http://rainbowcreatures.com/product_flashywrappers.php
    There's an online demo for Flash Player on the website,beven it's not as good as the AIR ones because Flash Player encoder is really slow by not being able to use native code or HW acceleration. But it shows the layering on top of video.
    If you want to make something like this yourself, you'd need to go the native extensions route.

  • Record desktop with split audio tracks?

    Is there some program that can record the desktop, as well as multiple audio channels? I need to keep the audio channels split, so I can later individually mute them and edit them when I need to.
    If there is no such application available for Linux, I guess the only option would be to record the audio separately. Feel free to suggest audio recording applications able to record multiple channels too. I'd prefer to have just one application handling both video and audio though, as that prevents any potential syncing issues.
    Thanks in advance!

    Presuming you have your audio devices configured as separate streams (be they jack, alsa or pulse) you can use ffmpeg via the command line to record desktop using the x11grab input source and then route as many audio tracks as you desire. Check the ffmpeg wiki for more. Googlefu applies. Let me know if you need help with more direct information.

  • How to use JFFmpeg with JMF

    Hi ,
    I am trying to use Jffmpeg with JMF to extend the supported format in JMF. I added jffmpeg-1.1.0.jar in class path variable.And I also made necessary changes to JMF Registry for JFFMPEG given in following url:
    http://jffmpeg.sourceforge.net/download.html
    But I could not play any mp4 video with JMF Studio.
    So,can any one help me to solve this problem?
    Thanks in advance
    Regards,
    Jyotirmoy

    This may not help much re Solaris, but is worth putting up here for reference for others, whilst the code structure may also be useful anyway being close to pure java and as a solution that reads & saves every frame.
    For Windows the folder in the zip includes Fobs4jmf, and - if necessary - setting preferences via the runjmstudio.bat should mean that the sun.bat will work for .mp4 and .flv video files.
    See vid2jpg.zip at http://www.exactfutures.com/index02.htm which includes the java source.

  • Can't recording desktop with vokoscreen 2.1.0

    Hi
    I have this problem with vokoscreen, so I can not recording my  desktop , and after running vokoscreen from terminal i got this:
    $ vokoscreen
    [vokoscreen] Locale: "en_US"
    [vokoscreen] Version: "2.1.0"
    [vokoscreen] Qt Version: 4.8.6
    [vokoscreen] asoundlib Version: "1.0.29"
    [vokoscreen] current icon-theme: "Ultra-Flat"
    [vokoscreen] ---Begin Search external tools---
    [vokoscreen] Find ffmpeg Version: "02.06.1()2000-2015"
    [vokoscreen] Find pactl Version: "6.0"
    [vokoscreen] Find mkvmerge Version: "v7.8.0"
    [vokoscreen] ---End search external tools---
    [vokoscreen] ---Begin search Screen---
    [vokoscreen] Number of screens: 1
    [vokoscreen] "Display 1: 1366 x 768+0+0"
    [vokoscreen] ---End search Screen---
    [vokoscreen] added device ("video0")
    [vokoscreen] connected devices ("video0")
    ### v4l2 device info [/dev/video0] ###
    [vokoscreen] ---Begin search Videoplayer---
    [vokoscreen] Find Videoplayer : "/usr/bin/kdenlive"
    [vokoscreen] Find Videoplayer : "/usr/bin/totem"
    [vokoscreen] Find Videoplayer : "/usr/bin/vlc"
    [vokoscreen] ---End search Videoplayer---
    [vokoscreen] [Regional selection] Frame locked: false
    [vokoscreen] ---Begin search PulseAudio Plugin---
    [vokoscreen] Found file .asound for PulseAudio Plugin
    [vokoscreen] ---End search PulseAudio Plugin---
    [vokoscreen] ---Begin Pulse unload Module---
    [vokoscreen] ---End Pulse unload Module---
    [vokoscreen] ---Begin search Alsa capture device---
    [vokoscreen] alsa_device_sample() in alsadevice.c: cannot open audio device hw:0,3 (No such file or directory)
    [vokoscreen] Find CaptureCard: "[hw:0,3] HDA Intel HDMI"
    [vokoscreen] alsa_device_sample() in alsadevice.c: open audio device hw:1,0 (Success)
    [vokoscreen] alsa_device_sample() in alsadevice.c: Samplerate = 44100
    [vokoscreen] Find CaptureCard: "[hw:1,0] HDA Intel PCH"
    [vokoscreen] ---End search Alsa capture device---
    [vokoscreen] ---Begin search PulseAudio Capture Devices---
    [vokoscreen] Find CaptureCard: "Monitor of Built-in Audio Digital Stereo (HDMI)" with device: "alsa_output.pci-0000_00_03.0.hdmi-stereo.monitor"
    [vokoscreen] Find CaptureCard: "Monitor of Built-in Audio Analog Stereo" with device: "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
    [vokoscreen] Find CaptureCard: "Built-in Audio Analog Stereo" with device: "alsa_input.pci-0000_00_1b.0.analog-stereo"
    [vokoscreen] ---End search PulseAudio Capture Devices---
    [vokoscreen] Report: recording fullscreen: 0
    [vokoscreen] Report : "-report "
    [vokoscreen] Executive command : "ffmpeg -report -f x11grab -framerate 25 -video_size 1366x768 -i :0.0+0,0 -dcodec copy -f alsa -i pulse -pix_fmt yuv420p -c:v mpeg4 -c:a libmp3lame -q:v 1 /tmp/vokoscreen-vokoscreen/vokoscreen-2015-04-04_13-51-40.mkv"
    [vokoscreen] "ffmpeg" is running and is ready for reading and writing
    [vokoscreen] "ffmpeg" is not running
    [vokoscreen] [Regional selection] Frame locked: false
    [vokoscreen] ---Begin Pulse unload Module---
    [vokoscreen] ---End Pulse unload Module---

    ChemBro wrote:Maybe try SimpleScreenRecorder? It's in [community].
    thanks man you just saved me,but the problem is still unsolved
    Last edited by hayderctee (2015-04-04 23:25:31)

  • How to Switch Desktop with fadein(fadeout) effect

    I create a desktop and the call SwitchDesktop to show the new desktop that i created.But i want the old desktop fades out and the new one fades in.or slide in(out).i can't endure the effect of blink.thank you!

    How do you host the desktop? For example, is it possible to use a windows to host a desktop? If it is possible, maybe you could try to use AnimateWindow function. I haven't test this idea, maybe it just cannot do this.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms632669(v=vs.85).aspx
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to record sound with Java Sound?

    I just want to record a clip of sound and save it to a WAV file. I exhausted the web but didn't find a tutorial. Would someone be kind enough to give me a tutorial or a sample code? The simpler the better. Thanks.

    Here's the code I used to record and play sound. Hope the length do not confound you.
    import javax.sound.sampled.*;
    import java.io.*;
    // The audio format you want to record/play
    AudioFormat.Encoding encoding = AudioFormat.Encoding.PCM_SIGNED;
    int sampleRate = 44100;
    byte sampleSizeInBits = 16;
    int channels = 2;
    int frameSize = 4;
    int frameRate = 44100;
    boolean bigEndian = false;
    int bytesPerSecond = frameSize * frameRate;
    AudioFormat format = new AudioFormat(encoding, sampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian);
    //TO RECORD:
    //Get the line for recording
    try {
      targetLine = AudioSystem.getTargetDataLine(format);
    catch (LineUnavailableException e) {
      showMessage("Unable to get a recording line");
    // The formula might be a bit hard :)
    float timeQuantum = 0.1F;
    int bufferQuantum = frameSize * (int)(frameRate * timeQuantum);
    float maxTime = 10F;
    int maxQuantums = (int)(maxTime / timeQuantum);
    int bufferCapacity = bufferQuantum * maxQuantums;
    byte[] buffer = new byte[bufferCapacity]; // the array to hold the recorded sound
    int bufferLength = 0;
    //The following has to repeated every time you record a new piece of sound
    targetLine.open(format);
    targetLine.start();
    AudioInputStream in = new AudioInputStream(targetLine);
    bufferLength = 0;
    for (int i = 0; i < maxQuantums; i++) { //record up to bufferQuantum * maxQuantums bytes
      int len = in.read(buffer, bufferQuantum * i, bufferQuantum);
      if (len < bufferQuantum) break; // the recording may be interrupted
      bufferLength += len;
    targetLine.stop();
    targetLine.close();
    //Save the recorded sound into a file
    AudioInputStream stream = AudioSystem.getAudioInputStream(new ByteArrayInputStream(buffer, 0, bufferLength));
    AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
    File file = new File(...); // your file name
    AudioSystem.write(stream, fileType, file);
    //TO PLAY:
    //Get the line for playing
    try {
      sourceLine = AudioSystem.getSourceDataLine(format);
    catch (LineUnavailableException e) {
      showMessage("Unable to get a playback line");
    //The following has to repeated every time you play a new piece of sound
    sourceLine.open(format);
    sourceLine.start();
    int quantums = bufferLength / bufferQuantum;
    for (int i = 0; i < quantums; i++) {
      sourceLine.write(buffer, bufferQuantum * i, bufferQuantum);
    sourceLine.drain(); //Drain the line to make sure all the sound you feed it is played
    sourceLine.stop();
    sourceLine.close();
    //Or, if you want to play a file:
    File audioFile = new File(...);//
    AudioInputStream in = AudioSystem.getAudioInputStream(audioFile);
    sourceDataLine.open(format);
    sourceDataLine.start();
    while(true) {
      if(in.read(buffer,0,bufferQuantum) == -1) break; // read a bit of sound from the file
      sourceDataLine.write(buffer,0,buffer.length); // and play it
    sourceDataLine.drain();
    sourceDataLine.stop();
    sourceDataLine.close();You may also do this to record sound directly into a file:
    targetLine.open(format);
    targetLine.start();
    AudioInputStream in = new AudioInputStream(targetLine);
    AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
    File file = new File(...); // your file name
    new Thread() {public void run() {AudioSystem.write(stream, fileType, file);}}.start(); //Run this in a separate thread
    //When you want to stop recording, run the following: (usually triggered by a button or sth)
    targetLine.stop();
    targetLine.close();Edited by: Maigo on Jun 26, 2008 7:44 AM

  • Share desktop with Microsoft Lync

    Hi guys,
    I was wondering if anyone knows how to share desktops with Microsoft Lync peers?  I would like to be able to view as well as share my desktop.  I have a working pidgin sipe configuration, but haven't come across any documentation indicating pidgin can work like lync (share/view desktops).
    Any other ideas as to what I might try?
    Thanks,
    Walter

    Thanks Holger. That blog is a bit over my head but also helpful. I had my network guy check our configuration on our Edge and 3478 UDP is open in both directions for the A/V service and IP so not sure what the issue is. As for our firewall, anything over
    1024 should be allowed out.
    In this particular incident, Microsoft sent me the meeting request and I initiated the request by clicking on the link in the email launching my locally installed Lync client. Microsoft tech then made me the presenter at which point I had the option to share
    my desktop. It's at this point that the connection drops.
    I turned on Centralized logging and clicked on the meeting invite from Microsoft one more time. The tech at the other end was not there of course but I did generate some traffic that I was able to view using Centralized logging. I determined that the traffic
    is most definitely going through the Edge server at least in this situation.
    I did find an error in the log that was interesting and have a question on. The error read:
    ms-diagnostics: 1017;reason="Cannot route From and To domains in this combination";summary="Cannot route between the source and destination domains because
    partner discovery is not enabled";external-domain="microsoft.com";external-type="domain-type-remote";internal-domain="mydomain.com"
    ";internal-type="domain-type-local";source="My edgeserver.com"
    ms-edge-proxy-message-trust: ms-source-type=EdgeProxyGenerated;ms-ep-fqdn=fqdn of my Edge;ms-source-verified-user=verified
    I took a look in Control Panel and under Federation and External Access --> Access Edge Configuration -->Enable partner domain discovery is NOT enabled. I am thinking
    I should not have to have a Federation with Microsoft to have a Lync meeting and share my Desktop, correct?
    I don't think turning this option on is a good thing because it looks like it will automatically establish a Federation with anyone and you lose control over which companies you want to Federate with.

  • I recorded audio with Quicktime player and the sound files won't disappear from the desktop no matter how I try to put them in the trash...

    I recorded audio with Quicktime player and the sound files won't disappear from the desktop no matter how I try to put them in the trash...tried xing out the red x, putting them in the trash...right clicking to make them disappear...nothing works...

    Just got rid of them... I closed Quicktime and was asked to delete. So I deleted them. Problem solved.

  • Recording (encoding) MP3 with JMF

    Hi all,
    I'm not sure to be the first one, but I ask anyway.
    Does anybody out there have a solution how to record (encode) MP3 with only using JMF.
    Your help will be highly appreciated !!!!!!
    Kind regards
    aro

    I havent installed that plugin but i can decode (play) mp3 files with jmf.
    So, i suppose it was for encoding.
    If anyone has proved the plugin... ?
    Anyway you can use fobs project or jffmpeg.

  • How to add shortcuts to user Start Menu and Taskbar or Desktop with using Microsoft Office 2013 Config file.

    Hello,
    How can i add the shortcuts for Office 2013 feature (Word, excel, ext) to the users taskbar or desktop with using config.xml file while installing the Microsoft Office 2013 from SCCM?
    I know how to do that with OCT, but i have another problem if i use OCT. So i have to do it with Config.file, but i don't know which code can i write on config.xml file to create shortcut on desktop or taskbar...
    Regards,

    Hi
    There is a known issue about
    changing the shortcut location for an Office 2013 application:
    When you try to change the shortcut locations for Office 2013 applications in the Office Customization Tool (OCT), you receive the following error message:
    Invalid start in folder. Please try again.
    Then, you add the Start in location for Office 2013 and run a customized installation. When you double-click the shortcuts that are displayed on the desktop, Configure shortcuts does
    not work and you receive the following error message: 
    Sorry, we couldn’t find your file. Is it possible it was moved, renamed or deleted?
    To work around this issue, type a single open bracket ([) in the Start in
    field.  
    In addition, refer to the link below on "Configure shortcuts" in OCT:
    http://technet.microsoft.com/en-us/library/cc179097.aspx#Configure_shortcuts
    Regards
    Tylor Wang
    TechNet Community Support

Maybe you are looking for

  • Need Help ASAP. Deleting Underline in Adobe Reader Touch.

    I don't understand why it won't let me delete the strikeout or underline in my Adobe Reader Touch. There is no clear option when I highlight it and write click and the "Ctrl-delete" option is not working either. I need to get rid of both of these. Di

  • View by when opening or saving pdf files

    I am currently using Adobe Acrobat X Pro 10.1.4 on Windows XP. When attempting to open or save a file through Acrobat or the Acrobat plugins, the file dialog box will start in the list view. If I attempt to change the view to details, it will change

  • How do you sort by album name?

    I have iTunes for Windows Vista, and I can sort music in my library by Name, Time, Artist, Genre, Rating, Play Count, and last played. However, there is no option to sort by album name. Shouldn't there be? Otherwise, how can I possibly find all the t

  • Hi, I'm Navica, Im 13 and I need help from anyone on this forum

    my dad got me this realy cool G3 clamshell ibook for xmas. but nothing works/___sbsstatic___/migration-images/migration-img-not-avail.png especially my new ipod. i NEED to update to at least 10.2 but cant seem to find out how to get it on here. my da

  • Inspection and Movement types...

    Hi ALL, Where can we find that for a particular inspection types what are the movement types assigned.... i.e. for eg : Inspection type '04' has movement types '101,261...etc assigned...Where do we assign these? Thanks Regards, Ameya K.