soantrinh / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

java cv 0.5 issue for mergeing audio with images #341

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use following code for record an audio with mp3 file it working fine i am 
getting output file but the audio length is not according to video i want that 
if the audio length is 10 second then video must be of 10 sec with single image 
    Thanks for any help

FFmpegFrameGrabber grabber1 = new FFmpegFrameGrabber(audio);  
            grabber1.start(); 
            FFmpegFrameRecorder recorder = new    
            FFmpegFrameRecorder(video,200,150, grabber1.getAudioChannels());  
            recorder.setVideoCodec(13);
            recorder.setFrameRate(grabber1.getFrameRate());  //30          
            recorder.setFormat("MP4");
            recorder.setPixelFormat(0); //PIX_FMT_YUV420P    
            recorder.start();
            com.googlecode.javacv.Frame frame1 = new com.googlecode.javacv.Frame();
           long no=grabber1.getLengthInTime();
           int i=0;
           while ((frame1 = grabber1.grabFrame()) != null) {
               i++;
               System.out.println("no="+i);
                recorder.record(frame1); 
                recorder.record(iplimage[0]);
            }

            recorder.stop();
            grabber1.stop();

Original issue reported on code.google.com by wnmte...@gmail.com on 19 Jul 2013 at 10:30

GoogleCodeExporter commented 9 years ago
If the frame rate is 30 FPS, then call record(IplImage) 300 times to get 10 
seconds of video, that's it.

Please post your questions on the mailing list next time if possible, thank you.

Original comment by samuel.a...@gmail.com on 19 Jul 2013 at 11:20

GoogleCodeExporter commented 9 years ago
When A Video File Is Created Grabbing Equivalent Frames Of Audio And Video 
..... Audio Finish At 23rd Frame Rest Of Video Is Played Without Any Sound When 
Frame rate Is Increased From 15 To 37 Video Quality Deteriorate. Any Solution 
To This Will Be Appreciated.  

Original comment by praveen....@gmail.com on 6 Aug 2013 at 8:41

Attachments: