<p>ffmpeg's <code>libx265</code> wrapper is very minimal, and doesn't pass on very many settings.  e.g. <code>-pass 1</code> requires manually setting <code>-x265-params pass=1</code>.</p>

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

<p>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.</p>

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

CC BY-SA 3.0
2015-02-25T04:42:49.893Z
2015-02-25T04:42:49.893Z
Peter Cordes
<p>I'm trying encode a video stream using HEVC with ffmpeg and create a MPEG-TS file. I need to be able to insert IDR frames to certain locations in the stream. I came across the flag <code>-force_key_frames</code> under ffmpeg documentation, but it doesn't seem to work for me. </p>

<p>Here is the command I tried:</p>

<p><code>ffmpeg -s:v 1280x720 -i input.yuv -c:v libx265 -x265-params crf=20:keyint=25:fps=25:preset=ultrafast -force_key_frames 1,12,30,111 -f mpegts out.ts</code></p>

<p>Please help me to sort out this issue.</p>

<p>Thanks.</p>

<ffmpeg><transcoding>
using -force_key_frames in ffmpeg with libx265
userDtrm
# using -force_key_frames in ffmpeg with libx265

(Asked by: username_0 on 2015-02-24)

I'm trying encode a video stream using HEVC with ffmpeg and create a MPEG-TS file. I need to be able to insert IDR frames to certain locations in the stream. I came across the flag `-force_key_frames` under ffmpeg documentation, but it doesn't seem to work for me.

Here is the command I tried:

`ffmpeg -s:v 1280x720 -i input.yuv -c:v libx265 -x265-params crf=20:keyint=25:fps=25:preset=ultrafast -force_key_frames 1,12,30,111 -f mpegts out.ts`

Please help me to sort out this issue.

Thanks.

**Tags:** ffmpeg, transcoding


---

## 1 answers

### Answer by username_1 on 2015-02-25. Score: 1

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.


---

