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:
Using another encoder like nvenc is also acceptable.
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.