Hi
I have an AVPlayer written in Delphi using the FFMPEG libraries. This basically implements a video player as per FFPLAY but under Delphi.
I want to add variable speed video playback to this player, which is easy on the video side as you simply change the period to delay between each frame and the video plays at the desired rate.
However, the audio then gets out of sync. Even though I am using the video clock, the standard audio sync to the video doesn't correctly match the video.
From looking at the code, the Delphi implementation seems to basically parallel the ffplay operation, using the ffmpeg library and SDL for the player. This has synchronisation between audio and video if you set the video clock as master, but it doesn't keep them in sync.
They sync again after a seek, but I would like to be able to change speed on the fly, so really want them to stay in sync.
I got a bit of an understanding of the operation by referring to this tutorial
ffmpeg tutorial[
^]
But it doesn't provide any suggestions on variable speed playback.
As I already have the delphi source, I would ideally like to just add to the existing code rather than trying a whole new component.
What I have tried:
As I don't need audio when playing video at a different rate, I am thinking I just need to get the delphi code to simply discard audio when not playing at normal speed and keep the audio seek position at the video position for when the video resumes at normal speed. However, I am not sure where to start looking to do this. I tried increasing the SAMPLE_CORRECTION_PERCENT_MAX from 10 to 50 and this did improve things a bit at double speed playback, but didn't work at all for 25% playback speed