Menu

Problem A/V recording

Anonymous
2015-03-22
2015-03-30
  • Anonymous

    Anonymous - 2015-03-22

    Hi,

    I'm trying to perform a/v recording. The video capture works fine, but if I add the audio the video freezes immediately after start. Here the sample code:

    try {
                Video<MBFImage> video = new VideoCapture(320, 240);
                JavaSoundAudioGrabber audio = new JavaSoundAudioGrabber(new AudioFormat(16, 44.1, 2));
                VideoDisplay<MBFImage> display = VideoDisplay.createVideoDisplay(video, audio);
            } 
            catch (VideoCaptureException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    

    I've started to debug the audio part and found out that the AudioPlayer exits immediately after start. The reason is that the isStopped() state of JavaSoundAudioGrabber will be set to false only in its run() method, which unfortunately is not called from the AudioPlayer. As far as I understand this causes the video thread to sleep forever as it assumes it is out of sync with the audio stream.

    Because I'm completely new to openIMAJ could you please advise me if this is the right way to accomplish my task or am I doing something completely wrong? I couldn't find any such example so far, but may be I've missed something...

    Any help will be highly appreciated.

    TIA,
    Ilko

     
  • Jonathon Hare

    Jonathon Hare - 2015-03-30

    You have to manually start the grabber in a new thread to use it:

       new Thread(audio).start();
    

    (before the VideoDisplay is created). However, looking at the code of the grabber, it appears that this still won't currently work as the time codes of the audio samples are not being correctly set. I'll have to have a deeper look and try and understand what's going on...

     

    Last edit: Jonathon Hare 2015-03-30

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.