I'm trying to follow this tutorial: https://www.reddit.com/r/brokenanimegifs/wiki/tutorial

Everything works perfectly. On the basis of this tutorial, I even created my own little tool. It just removes original I-frames and replaces with new one, all works fine with h264 (libx264).

Now I want to repeat this on the basis of x265, as it has a better algorithm for detecting motion and smearing the picture. But unfortunately, nothing works! I tried about such coding options:

 ffmpeg -i source.avi -vcodec libx265 -an -bf 0 -x265-params no-pme:subme=1:\
 force-flush=1:frame-threads=1 -t 30 -y result.avi

But it did not help.

I learned that x265 has many types of I-frames, I suspect that it's all about this. I can replace only the first I-frame in file, it works as before. But I can not change any other I-Frames and get the error in place of replacement, errors like:

  [hevc @ 0xb372940] Could not find ref with POC -60:00:09.17 bitrate=62974.5kbits/s dup=2 drop=0 speed=9.14x    
  [hevc @ 0xb372940] Could not find ref with POC -12:00:20.56 bitrate=62974.5kbits/s dup=2 drop=0 speed=10.2x 

Do you think you can repeat this with x265? Here exists any options to force IDR-frames and disable advanced coding techniques?

  • 1
    Use the last command in this answer to identify HEVC IDR frames and try to alter only those.
    – Gyan
    Commented Apr 21, 2018 at 5:21
  • Thanks! I seen this post before, but I have opposite task: find I frames in stream (done at container level), RE-ENCODE this frames, inject in original streams, subsequent frames refer to the coded keyframe and for some reason an error occurs. I understand that the encoded frame, which I substitute, clears the buffer, but it should not be. So I'm looking for a way how to encode each frame sequence (GOP) most independently.
    – bukkojot
    Commented Apr 21, 2018 at 6:53
  • Yeah, my answer will help you "find I frames in stream" - only the IDR kind. For the remaining Don't know of a direct option to suppress x265 from generating CRA/BLA frames. It could be a side-effect of some other options.
    – Gyan
    Commented Apr 21, 2018 at 13:40
  • Actually I parsing AVI container at byte level. I want to change ANY I-frame, as start every new scene in file. It will be perfect to force IDR-frames at new scenes.
    – bukkojot
    Commented Apr 22, 2018 at 4:40
  • I think, I-frames in x265 is dependent frames. According to this: dustsigns.de/CMS/wp-content/uploads/HEVC.pdf - page 18, I need CRA / BLA / IDR only for frame replacing.
    – bukkojot
    Commented Apr 22, 2018 at 4:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.