[Lazarus] Can LazVlc update the length of a file while playing?
Bo Berglund
bo.berglund at gmail.com
Mon Nov 11 09:08:24 CET 2024
I have created a video player/editor based on PasLibVlc some 5-6 years ago and
it works for the original purposes. This is on Windows 10. It was created to
handle mp4 files, but it can open other video file formats as well, thanks to
the VLC back-end.
Now I have a new use which it cannot perform properly:
In order to be able to view an Internet video stream when it is being downloaded
using ffmpeg I could not use mp4 format since such a file is not playable until
it has been closed by ffmpeg. At close ffmpeg writes crucial information to the
file which allows playback.
So I tested to set the ffmpeg output format to be a ts (transport stream) file
which I want to view before the download ends. This type of file should be
playable at all times.
But if I open the file for viewing the PasLibVlc library reads the current
length at that time into some internal property, which never changes...
I.e. the length of the playing video is not increasing as the donwnload
progresses.
This means that only that part which was present at the time of opening the file
for viewing will be available since the player exits when it reaches the
percieved "end".
I have tried adding a refresh function to my player but it does not work.
And it does not even help to close and re-open the video file, somehow the
information has been cached somewhere and the old length data reappears.
The only way I have found to actually get a new length is to open a completely
different video file and then re-open the original file, then the length
updates...
So it seems like there is some caching being done by VLC, which affects playing
of the same file and giving the erroneous file length....
QUESTION:
---------
So my question is if I would try to use the LazVlc package instead of PasLibVlc,
is there a command to clear any cached VLC data so a re-opening of a file during
recording will get the correct current length of it?
Notice that the VLC Player itself behaves in the same way, open the ts file at
some time and note the length, then close it, wait a bit and then re-open the
file and the OLD length is again shown!
So I cannot use that player either, I need to build my own viwer if the existing
player/editor cannot be made to work for this scenario...
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list