Search code examples
opencvffmpegvideo-capturevideo-processingjavacv

Create 1080p videos with javacv and ffmpeg or alternate lib


is there a option in JavaCV to capture 1080p videos from images? If i use the FFmpegFrameRecorde, i only find 480p.

Or is there a alternate library for Java? I want to use it to create a video from kind of pictures (with zooming and rotating effects)

greetings

//EDIT

Okay, now i've tested a very simple code:

    FrameRecorder  recorder = FFmpegFrameRecorder.createDefault("out.avi", 1920, 1080);
    recorder.start();
    recorder.record(iplImage);
    recorder.stop();

and it's works! But the file is very large (10sec around 300MB...)

Now i want to add a codec like xvid. I've get the following eyxception:

com.googlecode.javacv.FrameRecorder$Exception: codec not found

But i've installed the xvid paket. Must i add the codec in a special folder like the ffmpeg bin?


Solution

  • Okay, now i test the mp4 codec and all works fine :)

    //UPDATE

    for JavaCV 0.2

        FrameRecorder recorder = FFmpegFrameRecorder.createDefault("out.avi", 1920, 1080);
        recorder.setCodecID(CODEC_ID_MPEG4);
        recorder.setPixelFormat(PIX_FMT_YUV420P);
        recorder.start();
                .....
        recorder.stop();
    

    for JavaCV 0.3

        FrameRecorder recorder = FFmpegFrameRecorder.createDefault("out.avi", 1920, 1080);
        recorder.setVideoCodec(CODEC_ID_MPEG4);
        recorder.setFrameRate(fps);
        recorder.setFormat("avi");
        recorder.start();
                .....
        recorder.stop();