CrazyOrr / FFmpegRecorder

An Android video recorder using JavaCV and FFmpeg.
202 stars 48 forks source link

Video is green color using avutil.AV_PIX_FMT_NV21 format #42

Open ritesh94 opened 6 years ago

ritesh94 commented 6 years ago

setting the pixel format:

    FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame);

build.gradle

ext {
    versions = [
            'ffmpeg': '3.4.1-1.4'
    ]
}

    compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.4') {
        exclude group: 'org.bytedeco.javacpp-presets'
    }

    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: versions.ffmpeg, classifier: 'android-arm'

Tried the following too, but no luck: 1.

 mFrameRecorder.setPixelFormat(avutil.AV_PIX_FMT_NV21);
FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame);

2.

mFrameRecorder.setPixelFormat(avutil.AV_PIX_FMT_NV21);
FFmpegFrameFilter frameFilter = new FFmpegFrameFilter(TextUtils.join(",", filters),
                    previewWidth, previewHeight);
            frameFilter.setPixelFormat(AV_PIX_FMT_NV21);
mFrameRecorder.record(filteredFrame,AV_PIX_FMT_NV21);

 mFrameRecorder.record(filteredFrame,avutil.AV_PIX_FMT_NV21);
CrazyOrr commented 6 years ago

Confirmed this bug. You can use ffmpeg 3.2.1-1.3 with javacv 1.3 for the moment.

ritesh94 commented 6 years ago

@CrazyOrr Using the above version with other Gradle dependencies give me an Unsatisfied link error

Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil

CrazyOrr commented 6 years ago

Try this.

CrazyOrr commented 6 years ago

Try the latest version of JavaCV and ffmpeg, with 64-bit support, has this issue fixed already:

dependencies {
    ...
    def javacvVersion = '1.4.2'
    def ffmpegVersion = '4.0.1'
    compile(group: 'org.bytedeco', name: 'javacv-platform', version: javacvVersion) {
        exclude group: 'org.bytedeco.javacpp-presets'
    }
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: "${ffmpegVersion}-${javacvVersion}"
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: "${ffmpegVersion}-${javacvVersion}", classifier: 'android-arm' // for 'armeabi-v7a'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: "${ffmpegVersion}-${javacvVersion}", classifier: 'android-arm64' // for 'arm64-v8a'
}
abhijithrkrishna commented 5 years ago

Tried the latest version of JavaCV and ffmpeg, with 64-bit support, But problem remaining.