AMF icon indicating copy to clipboard operation
AMF copied to clipboard

Unclear documentation for SetPts and SetDuration

Open e00E opened this issue 4 years ago • 8 comments

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.

e00E avatar Nov 21 '21 18:11 e00E

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.

rhutsAMD avatar Nov 22 '21 21:11 rhutsAMD

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.

e00E avatar Nov 23 '21 01:11 e00E

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.

e00E avatar Nov 23 '21 10:11 e00E

I found the answer: The header groups the framerate setting under rate control so I expect this is what it is used for.

e00E avatar Nov 25 '21 03:11 e00E

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.

MikhailAMD avatar Nov 25 '21 14:11 MikhailAMD

Thank you again, this is valuable info. I wish it was documented somewhere that isn't a Github issue.

e00E avatar Nov 25 '21 14:11 e00E

We appreciate your feedback and working on documentation improvements.

MikhailAMD avatar Nov 25 '21 14:11 MikhailAMD

The documentation has been updated and will be visible in a future AMF release. In the meantime, I will share the updated information below:

image

rhutsAMD avatar Apr 08 '22 16:04 rhutsAMD