huanganhen / javacv

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

Android video record using H264 format is to large #489

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Record a Video in H264 format from Android Camera
2. Save the mp4 in sdcard
3. Video I getting saved but size is too high and while merging FrameGrabber is 
getting failed.

What is the expected output? What do you see instead?
The size using MPEG4 for a 10 sec video is 2 MB where as H264 video is 30 mb

What version of the product are you using? On what operating system?
JAVACV 0.9

Please provide any additional information below.
I want to merge multiple videos.But If I am using H264 format its failing.
below is the code I am using to concat two videos
FrameGrabber grabber1 = new FFmpegFrameGrabber(file1);

            grabber1.start();

            Log.i(LOG_TAG, "graber1.start");
            FrameGrabber grabber2 = new FFmpegFrameGrabber(file2);
            grabber2.start();
            Log.i(LOG_TAG, "graber2.start");
            FrameRecorder recorder2 = new FFmpegFrameRecorder(output, grabber1.getImageWidth(),
                    grabber1.getImageHeight(), grabber1.getAudioChannels());
            recorder2.setFrameRate(grabber1.getFrameRate());
            recorder2.setSampleFormat(grabber1.getSampleFormat());
            recorder2.setSampleRate(grabber1.getSampleRate());
            recorder2.setVideoQuality(0);
            recorder2.setAudioBitrate(12800);
            Log.i(LOG_TAG, "Recorder.start");
            recorder2.start();
            Frame frame;
            int j = 0;

            while ((frame = grabber1.grabFrame()) != null) {
                recorder2.setTimestamp(grabber1.getTimestamp());
                recorder2.record(frame);
            }

            long t = recorder2.getTimestamp();
            while ((frame = grabber2.grabFrame()) != null) {
                recorder2.setTimestamp(t + grabber2.getTimestamp());
                recorder2.record(frame);
            }
            Log.i(LOG_TAG, "Recorder.stop");
            recorder2.stop();
            grabber2.stop();
            grabber1.stop();
            Log.i(LOG_TAG, "end concatenate");

Original issue reported on code.google.com by amlan....@gmail.com on 20 Oct 2014 at 7:33

GoogleCodeExporter commented 9 years ago
`setVideoQuality(0)` is likely to give you lossless compression. Please try a 
number > 0, and please post your questions on the mailing list next time if 
possible, thank you.

Original comment by samuel.a...@gmail.com on 25 Oct 2014 at 1:27