ffmpeg encode in all-i mode h264 and h265 streams
For H264

ffmpeg -i input -c:v libx264 -intra output


For H265, seems no alias or preset has been set yet

ffmpeg -i input -c:v libx265 -x265-params frame-threads=4:keyint=1:ref=1:no-open-gop=1:weightp=0:weightb=0:cutree=0:rc-lookahead=0:bframes=0:scenecut=0:b-adapt=0:repeat-headers=1 output


H265 code stolenborrowed from here.