using -force_key_frames in ffmpeg with libx265
ffmpeg's libx265 wrapper is very minimal, and doesn't pass on very many settings.  e.g. -pass 1 requires manually setting -x265-params pass=1.

Also, if x265 is anything like x264, don't use ultrafast except for lossless or for testing things.

sorry for not taking the time to dig this up myself, but have a look and see if you can get your desired I frame locations into x265-params.  Probably not, though.

If you want to hack some C code, have a look at libx264.c and libx265.c, and maybe you can see how to ffmpeg sends frame-type requests to x264.  And maybe you can port that to the libx265 wrapper.