title: Unhandled exception at mfh265enc.dll
body: <p>I'm trying to encode video with H.265 encoder MFT on Win10 Pro Insider Preview.</p>
  
  <ul>
  <li>Originally I create/init an H.265 encoder in my own program and call ProcessInput/ProcessOuput and it crashed inside ProcessOuput (It didn't crash on first frame, instead it crashed after several frames have been processed).</li>
  <li><p>To simplify the question, I used IMFSinkWriter to create a sink, so frame encoding/writing thus is totally handled by sinkwriter. But unfortunately crash still happened inside mfh265enc.dll.</p>
  
  <p>Please note that in above 2 cases, the change I made was on a program which can successfully encode H.264 video. I only changed the output media type for Encoder/SinkWriter (changed subtype from H.264 to H.265). The way video frames got constructed, supplied to encoder/sinkwriter keep same. When encoding with H.264 everything was good, but once changed to H.265 it crashed.</p></li>
  <li><p>Then I turned to the sample program comes with <strong>Win7 SDK: MFCaptureToFile</strong> which could capture video into a MP4 file.</p>
  
  <p>I'm sure the video format from camera is acceptable to H.265 encoder.</p>
  
  <p>The only change I've done is to the outputmedia type which is passed to SinkWrite.AddStream. </p>
  
  <p>I've changed the subtype to MFVideoFormat_HEVC, and set MF_MT_MPEG2_PROFILE to 1 (eAVEncH265VProfile_Main_420_8).</p>
  
  <p>But with the 2 changes above, the program still crashes. Showing "Unhandled exception at 0x5A025085 (mfh265enc.dll) in MFCaptureToFile.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF"</p>
  
  <p>Here's the change I've made to the MFCaptureToFile program.
  <a href="https://www.dropbox.com/s/oytqen13m7bcs23/DIFF.PNG?dl=0" rel="nofollow">https://www.dropbox.com/s/oytqen13m7bcs23/DIFF.PNG?dl=0</a></p></li>
  </ul>
  
  <p>Hope someone can help. Thanks</p>