
Here's a working, minimal project that interacts with HandBrakeInterop: You had a really good idea in just taking the EncodingProfile from the XML.
HANDBRAKE FULL
Yeah HandBrakeInterop isn't the easiest API to just write some code for it's more geared toward full encoder GUIs right now it doesn't fall back on defaults very well. Message=Object reference not set to an instance of an object.Īt (IntPtr structPtr) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\InteropUtilities.cs:line 31Īt (EncodeJob job, Boolean preview, Int32 previewNumber, Int32 previewSeconds, Double overallSelectedLengthSeconds) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 412Īt _ScanCompleted(Object sender, EventArgs e) in c:\Users\user\Documents\Visual Studio 2012\Projects\HandBrakeTest\HandBrakeTest\Program.cs:line 65Īt () in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 811Īt _2(Object o, ElapsedEventArgs e) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 752Īt (Object state)

Now, the exception is Nullreferenceexception with this in the details : System.NullReferenceException was unhandled by user code Calling StartEncode in scan completed event.Moved handbrakeinstance and encodingjob's instance outside main and made them static.ObjJob.RangeType = .Frames ĮDIT : As requested,here's more info from the exception copied to clipboard System.ArgumentNullException was unhandledĪt (IEnumerable`1 source, Func`2 predicate)Īt (Int32 titleNumber) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 1604Īt (Int32 titleNumber) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 1614Īt (EncodeJob job, Boolean preview, Int32 previewNumber, Int32 previewSeconds, Double overallSelectedLengthSeconds) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 411Īt (EncodeJob jobToStart) in c:\HandBrake\Hudson\workspace\Release_WindowsGui64\0.9.9\win\CS\HandBrake.Interop\HandBrakeInterop\HandBrakeInstance.cs:line 395Īt (String args) in c:\Users\user\Documents\Visual Studio 2012\Projects\HandBrakeTest\HandBrakeTest\Program.cs:line 53Īt System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String args)Īt .RunUsersAssembly()Īt (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)Īt (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)Īt (ExecutionContext executionContext, ContextCallback callback, Object state)Īt () ObjHb.EncodeCompleted += objHb_EncodeCompleted ObjHb.EncodeProgress += objHb_EncodeProgress ObjJob.EncodingProfile = objPresetFromFile Var objPresetFromFile = objSerializer.Deserialize(mem) as EncodingProfile MemoryStream mem=new MemoryStream(File.ReadAllBytes( + "normal.xml")) XmlSerializer objSerializer = new XmlSerializer(typeof(EncodingProfile)) ObjProfile.PreferredExtension = OutputExtension.Mp4 ObjProfile.VideoEncodeRateType = VideoEncodeRateType.ConstantQuality ObjJob.SourceType = .File ĮncodingProfile objProfile = new EncodingProfile() Tried changing debug versions from x86/圆4.Copied all the other required dlls to my debug folder and even tried adding them as references.Added a reference to HandBrakeInterop.dll.What I've tried so far (points are not relevant to the error displayed.Just FYI) :



I would appreciate any of your guidance to help me get this work. As you can see in the screenshot below, I've tried a couple of things based on what I know. It keeps throwing the error "Value cannot be null.". I am unable to get Handbrake to work for me in C#.
