1

I want to generate a h.264 stream in which P-frames are using references exclusively using a long-term reference to the first frame (an IDR frame). This would also require the first frame to be an IDR frame.

This is an academic experiment to understand the encoding behavior of long-term references and the consequences of forcing frames to refer to a specific (single) frame rather than several.

It would be great if I could do this from the command line, but if not possible I am open to modifying x264 for this purpose.

Could anyone point me to where in the source code it is determined:

  • the reference frame / macroblock / partition for the current macroblock
  • changes made to the short term, long term reference frame list
  • whether to use a short term reference frame or a long term reference frame.

Using another encoder like nvenc is also acceptable.

cloudraven
  • 2,484
  • 1
  • 24
  • 49

1 Answers1

1

You don’t need to modify the source library. Just the command line tool. x264 has a feature called “reference frame invalidation”. You can just invalidate every frame after the first one. It is documented in the header file.

szatmary
  • 29,969
  • 8
  • 44
  • 57
  • That's right. Thanks Turns out NVEnc also supports that. Quick and easy. Thank you – cloudraven Jan 01 '20 at 04:22
  • @cloudraven Did you get NVENC to work properly with reference frame invalidation? I asked a question related to this, because it doesn't seem to work for this use case: https://forums.developer.nvidia.com/t/using-invalidatereferenceframes/118463 – theicfire Apr 03 '20 at 20:24
  • @theicfire yes, it worked perfectly for me. However, I was using it to force frames to refer to a specific frame rather than to make te encoder forget about a specific frame as in your case – cloudraven Apr 04 '20 at 22:20
  • @cloudraven I think something like that would be totally sufficient. How do you force a reference back to a specific frame, without being able to get the encoder to forget about a specific frame? – theicfire Apr 05 '20 at 23:11