Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2024-10

Using PasLibVLC to play video files - how to update duration?

3 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

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

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 16 lines
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....

UPDATE:
-------

I tested with the VLC Video player (on which video handling functions PasLibVLC relies) by opening a running download target file in ts format while it was still being written.

The VLC Video player read the video length upon starting and once it reached playing to that time it just exited!
That is when the file at that time held a lot more content but past the original ending timestamp...

So I guess (before testing actual coding) that the VLC library will not supply such a functionality as dynamically updating a ts file length...

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 35 lines
On Sun, 27 Oct 2024 14:51:04 +0100, Bo Berglund via lazarus wrote: >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.... > UPDATE: ------- I tested with the VLC Video player (on which video handling functions PasLibVLC relies) by opening a running download target file in ts format while it was still being written. The VLC Video player read the video length upon starting and once it reached playing to that time it just exited! That is when the file at that time held a lot more content but past the original ending timestamp... So I guess (before testing actual coding) that the VLC library will not supply such a functionality as dynamically updating a ts file length...

So I got no reply on ths question...
Can someone please suggest a better location for asking? Will the Lazarus Forum be better or else where can I get feedbacxk from trhose "in the know"?

Meanwhile I have been trying to use KODI as a playback channel for the video being downloaded and that would in fact continue plaing across the video length at the start of playing. But it will not function correctly when doing skips back or forth whan you have played across the start length position...

As I stated above the VLC Video Player does not handle a ts file which is growing in size when it plays it. When it reaches the initial length of the video it just quits even if the video at that time is much longer...

Bo Berglund Developer in Sweden

Reply by email