opencvsharp: Unable to find an entry point named 'videoio_VideoWriter_fourcc' in shared library 'OpenCvSharpExtern'.

Error using VideoWriter: Unable to find an entry point named 'videoio_VideoWriter_fourcc' in shared library 'OpenCvSharpExtern'.

  • package:
<PackageReference Include="OpenCvSharp4" Version="4.9.0.20240103" />
<PackageReference Include="Sdcb.OpenCvSharp4.mini.runtime.ubuntu.22.04-x64" Version="4.8.0.20231125" />
  • code:
 VideoWriter writer = new VideoWriter("video.mp4", VideoWriter.FourCC('M','P','4','V') , 1, new Size(568, 320), true);
  • Operating environment:
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

Use practical programming techniques. Try this.

  1. use Usings
  2. use the FourCC.H264
  3. use a mat for the resize
  4. sure you want a frame rate of 1?
using (VideoWriter writer = new VideoWriter(
  "20240201.mp4", 
   FourCC.H264,
  1, 
  new OpenCvSharp.Size(1920, 1080), 
  true)) {

var path = Path.Combine(AppContext.BaseDirectory, "Images");

using (Mat resized = new Mat()) 
foreach (var item in Directory.GetFiles(path)) {

   using (Mat  mat = Cv2.ImRead(item, ImreadModes.Color)) {

    Cv2.Resize(mat, resized, new OpenCvSharp.Size(1920, 1080));

    writer.Write(resized);
  }
}
}