Skip to content

VideoWriter: failed to load codec library, yet video is processed and saved #1712

@michalgrzyska

Description

@michalgrzyska

Summary of your issue

I receive an error that a codec lib is not found, yet my video is processed correctly.

Environment

win-64

What did you do when you faced the problem?

I am just trying to use VideoCapture with avc1, process frames and use VideoWriter. Regular operation.
I was using mp4v but those videos cannot be used in Messenger, WhatsApp etc.

Example code:

using VideoCapture capture = new(inputPath);
using VideoWriter writer = new(outputPath, FourCC.FromString("avc1"), capture.Fps, captureSize);

using Mat frame = new();

// ... blah blah blah, some loop processing video
{
    writer.Write(frame);
}

Output:

Failed to load OpenH264 library: openh264-1.8.0-win64.dll
        Please check environment and/or download library: https://github.com/cisco/openh264/releases

[libopenh264 @ 000002500358f440] Incorrect library version loaded
[ERROR:0@0.021] global cap_ffmpeg_impl.hpp:3194 open Could not open codec libopenh264, error: Unspecified error (-22)
[ERROR:0@0.021] global cap_ffmpeg_impl.hpp:3211 open VIDEOIO/FFMPEG: Failed to initialize VideoWriter

What did you intend to be?

No error output. Video is processed anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions