The IVF format includes a 4-byte field for the number of frames. I could not find a specification to cite, but for example, the Chromium IVF parser handles this field. Please see: https://chromium.googlesource.com/chromium/src/media/+/master/filters/ivf_parser.h