rav1e icon indicating copy to clipboard operation
rav1e copied to clipboard

Update IVF Header with number of frames in file

Open vibhoothi opened this issue 3 years ago • 3 comments

Currently, we are not writing FrameNumber/number of frames in the file during the final bitstream creation. Would be beneficial if we find a mechanism to do it.

~Right now when the final bitstream is muxed to ivf, we are not writing bitrate, and duration.~

Ref: https://github.com/xiph/rav1e/blob/master/ivf/src/lib.rs

vibhoothi avatar Oct 22 '21 15:10 vibhoothi

Counterpart in libaom: https://github.com/m-ab-s/aom/blob/8c1aa3050e5ab883bc86e9c772be73b6d2b9d23c/common/ivfenc.c#L17

vibhoothi avatar Oct 22 '21 15:10 vibhoothi

Seeking back and forth isn't great in general and impossible if we are writing to a pipe. Is that information really needed?

lu-zero avatar Oct 22 '21 16:10 lu-zero

Hmm, After a quick discussion in the Watercooler with @barrbrain,

Adding the Frame count in bytes 24-27 as per spec[ 1 ] would solve the issue as the mediainfo and other parsers of IVF files computes internally. IIUC currently, we are writing 0 there https://github.com/xiph/rav1e/blob/master/ivf/src/lib.rs#L29

Currently, we do not have a mechanism to compute frame numbers if we do not supply limits. Related issue tracker, https://github.com/xiph/rav1e/issues/941

Ref: [ 1 ]: https://wiki.multimedia.cx/index.php/IVF

bytes 4-5    version (should be 0)
bytes 6-7    length of header in bytes
bytes 8-11   codec FourCC (e.g., 'VP80')
bytes 12-13  width in pixels
bytes 14-15  height in pixels
bytes 16-23  time base denominator
bytes 20-23  time base numerator
bytes 24-27  number of frames in file
bytes 28-31  unused```

vibhoothi avatar Oct 22 '21 20:10 vibhoothi