.Net or similar API?

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
akjohnston
Posts: 5
Joined: Mon Mar 13, 2017 6:23 am

.Net or similar API?

Post by akjohnston »

Hi,

I'm using Handbrake under Windows 10 (64-bit). I currently have a VB.Net Forms program which manages my files, and calls Handbrake CLI to do the conversions. However I'd like to convert this into a Windows service so that it will run silently and works whether the PC is logged in or not.

Does Handbrake expose a .Net API which I could use to call it directly from my service rather than via the CLI?

Thanks
Andrew
User avatar
s55
HandBrake Team
Posts: 10385
Joined: Sun Dec 24, 2006 1:05 pm

Re: .Net or similar API?

Post by s55 »

There is no formal API but the Windows UI is C# .NET and it wraps the native hb.dll so you could hack something around that. Noting that it's not treated as an API so the code could wildly change between versions :)
mduell
Veteran User
Posts: 8245
Joined: Sat Apr 21, 2007 8:54 pm

Re: .Net or similar API?

Post by mduell »

You could use libhb.dll like vidcoder does.
User avatar
s55
HandBrake Team
Posts: 10385
Joined: Sun Dec 24, 2006 1:05 pm

Re: .Net or similar API?

Post by s55 »

mduell, Windows UI has been using hb.dll for years. It has no CLI involvement. Works exactly the same as vidcoder as it's using the same C# wrapper code that is maintained out of our repos.
akjohnston
Posts: 5
Joined: Mon Mar 13, 2017 6:23 am

Re: .Net or similar API?

Post by akjohnston »

Sounds like hb.dll should do the job. I'll look into it. Thanks all.
akjohnston
Posts: 5
Joined: Mon Mar 13, 2017 6:23 am

Re: .Net or similar API?

Post by akjohnston »

Hi. I'm falling at the first fence. I've tried adding hb.dll as a reference/dependency to both a VB.Net project using the .Net Framework (4.8), and to a C# project using .Net 6.0, but neither works.

Is there a trick to this? What version of .Net do I need to use in the wrapper project?

If I need to call it as an unmanaged API, does anyone have example code?

Thanks
mduell
Veteran User
Posts: 8245
Joined: Sat Apr 21, 2007 8:54 pm

Re: .Net or similar API?

Post by mduell »

s55 wrote: Tue Apr 23, 2024 7:50 pm mduell, Windows UI has been using hb.dll for years. It has no CLI involvement. Works exactly the same as vidcoder as it's using the same C# wrapper code that is maintained out of our repos.
I didn't say it had any CLI involvement.
Post Reply