Hello.
I have been trying to use the LibVLCSharp API to put together a multi view app that plays 3 video files.
The video files are 1920x1080 H264 25 fps.
Having 3 videos playing all the basic stuff works fine. (Play stop pause etc)
My problem is around sending each file to a specific Time location and also being able to move forward and backward one frame at a time.
All 3 files are produced by the same capture device but have each their own quirks.
i use code like this
foreach (var player in _PlayersCollection)
{
await Task.Run(async () =>
{
player.Time = 12000;
await Task.Delay(200);
player.Time = player.Time;
});
}
to send each mediplayer object a time to go to in this case 12 sec mark of each video.
During play back things seem fine.
the problems come in when the videos are all paused.
Doing this (regardless of the current time location of the video
1 x video seems to move 1 frame then stop
2 x video do nothing.
On experimenting i have discovered
1 x video will jump to the required location if i call the routine above twice with delays between the calls
2 x video will jump to the required location if i add _libVLC1 = new LibVLC("--file-caching=600");
each media player is linked to the same _libVLC1.
I also need to move forward and backwards by one frame so i have been using a loop with
foreach (var player in _PlayersCollection)
{
await Task.Run(async () =>
{
player.Time += 40;
await Task.Delay(200);
player.Time = player.Time;
});
}
to try and move forward and backwards 40ms at a time.
This is frankly hit and miss.
1 x video it is very reliable and moves backwards and forwards exactly like i want.
2 x video its laggy and hit and miss if it moves forwards or backwards at all.
I occasionally get this error showing up
[13094ee0] ts demux error: libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 10) for PID 0
[13094ee0] ts demux error: libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 10) for PID 16
Can anyone help with advice or examples on how i can apply these ideas in a more robust reliable manner with all 3 videos to get it to work reliably.
I know there is a player.nextframe() function but i cant use it because all the videos are synced time to a external timer and i need to move them forwards and backwards by specific amounts to stay in sync with the external timer.
Anyone any advice at all please i have run out of ideas.
Even links to c# winforms code where others have over come these problems would be appreciated.
Perhaps it would be possible to use the vlcsharp api with the current libvlc 4.0 build if it works better.
If so how to make that happen ?
thanks