Unclear documentation for SetPts and SetDuration
The documentation merely states that this sets a timestamp or duration. It is missing information on what this means. For example when I am sending frames to an encoder, do I need to set both fields? What happens if I don't? The SimpleEncoder example does not set either but other code in components does.
No, you are not required to set the timestamp or duration when simply sending frames to the encoder. The PTS or presentation timestamp is used to sync separate elementary streams such as audio and video when being presented. The SimpleEncoder sample does not set either because it is simply encoding NV12 frames to an elementary stream and does not need this type of synchronization.
Thank you for the explanation. I think an explanation like this makes sense in the PDF documentation but feel free to close this issue if you do not think it is appropriate.
One more follow up to this. It seems like the encoder needs to know how much time has passed between frames somehow in order to target a bitrate as measured per second. How is this communicated? Looking at the docs it seems it must be at least one of FRAMERATE, SetDuration, SetPts but I'm not sure which and it would be good to have that documented.
I found the answer: The header groups the framerate setting under rate control so I expect this is what it is used for.
Please note, that encoder doesn't do any timing or pacing. Framerate is used exclusively for bitrate control and to fill VUI header. Bitrate operates on frame count. It is up to the calling application to pace submissions if this is needed.
Thank you again, this is valuable info. I wish it was documented somewhere that isn't a Github issue.
We appreciate your feedback and working on documentation improvements.
The documentation has been updated and will be visible in a future AMF release. In the meantime, I will share the updated information below:
