[Lazarus] Using PasLibVLC to play video files - how to update duration?
Bo Berglund
bo.berglund at gmail.com
Sun Oct 27 14:51:04 CET 2024
So several years ago I wrote a Video player/editor usng Lazarus/FPC with the
PasLibVLC library. ( https://prog.olsztyn.pl/paslibvlc/ )
The last build was done in end of 2023 with the then current
FPC/Lazarus/PasLibVLC (3.0.7). It was a cleanup to remove some un-needed fluff
on screen not related to the video handling.
The utility has worked just fine for the video editing tasks it was created for.
It works by playing a downloaded mp4 video file on screen where I can accurately
set cut points for section removals. Then it creates the call to a split-combine
command line utility I also wrote with Lazarus and built for both Windows and
Linux.
This utility uses ffmpeg in a command that results in a new video file where the
marked sections are removed.
I usually work on files located on a Linux server but occationally I also run
the splitcombine on Windows.
Recently I have found that if I want to use the editor just as a player it does
not work with mp4 to view files still being downloaded, so I tested by changing
my download script to produce a ts file rather than mp4.
This file type can be opened and played while the download is still being done,
so the file is being written at the end and played somewhere inside.
So far OK, but I have problems when doing jumps since the current version of my
editor reads the full length of the video at the time the video file is opened
and that stays put. This means that some positioning operations are not possible
if they target a time beyond the file length at the time the playback started.
Question:
---------
How should I proceed to update the video length while playing it in the player?
It affects both the length displayed on screen as well as the progress bar
showing where the current playback position is located.
Should I set up a timer and use that to constantly read the video length (if it
is being updated by the library) and set the limits and visuals accordingly?
Or is there some means of handling it using some internal callback, event or
similar?
Unfortunately it was a while since I worked on the code so I will need some
start time to get re-familiarized....
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list