0xC0000054/libheif-sharp-samples

Error when running encoder with parameter -E or -e

hieudole opened this issue · 2 comments

Hi,

I run the encoder sample with the -E parameter but an error occurs

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at LibHeifSharp.Interop.LibHeifNative.heif_encoder_descriptor_get_name(LibHeifSharp.Interop.heif_encoder_descriptor)
at LibHeifSharp.Interop.LibHeifNative.heif_encoder_descriptor_get_name(LibHeifSharp.Interop.heif_encoder_descriptor)
at LibHeifSharp.HeifEncoderDescriptor..ctor(LibHeifSharp.Interop.heif_encoder_descriptor)
at LibHeifSharp.HeifContext.GetEncoderDescriptors(LibHeifSharp.HeifCompressionFormat, System.String)
at HeifEncoderSample.Program.Main(System.String[])

I want to use rav1e as AVIF encoder, so I copy rav1e.dll to the same folder as heif-enc.exe.
I run the command "heif-enc -e=rav1e -A sample.jpg sample.avif" but the same error occurs.
Is this the correct way to run the sample with a specific encoder, or am I doing wrong?

Thank you!

Is this the correct way to run the sample with a specific encoder, or am I doing wrong?

That is the correct way.

From the stack trace the failure is occurring within libheif.
What version of libheif are you using?

I ran heif-enc -E on libheif version 1.12 and it worked correctly,

That's right! The error occurs in libheif which I downloaded from vcpkg.
I have built the latest version of libheif (1.12.0) and it worked correctly.

Thanks for your quick reply.