I have written a Video player/editing tool about 5 years ago and I use it every day for editing downloaded streams (basically removing ads) before viewing them. They are saved on disk as mp4 files.
The downloads are done using an ffmpeg based script on an Ubuntu Linux server but my player is written for Windows.
The player is created using FreePascal/Lazarus and with the PasLibVlc opensource library, so it uses VLC functionality to work.
In order to be able to view the downloads before they are complete I have modified the download script (still using ffmpeg) so it saves the stream into a ts (transport stream) file instead of to mp4.
With this ts file format it is possible to view the video from the start while it is being written to at the end if I use a player like VLC-Player.
However that player seems to limit its play span to the file length at the time it opened the ts file so when it reaches the position corresponding to the video length at that time it exits playback....
But by then the video file's length is actually longer by the amount of time that has passed!
So now I am looking for a way to circumvent this problem in my own player, still using the VLC libraries that are part of the VLC player when it installs on the local computer.
I tried asking on the Lazarus mail list but got no replies so now I am testing VideoHelp instead...
I have also asked on a KODI forum since the Kodi file player seems able to play the ts file while it is being written to and also jump back and forth, however when the time of the length at start of playback is reached it no longer works properly when skipping or exit-restart etc.
No response to my question there as well...
Any suggestions welcome!
+ Reply to Thread
Results 1 to 10 of 10
-
-
I am on Windows10 because I was dissuaded from 11 when watching the struggle a friend of mine had when he let Windows upgrade...
I have just checked the VLC player version on my PC and it is 3.0.20 which seems to be the latest...
Using that I first started a video download from a streaming source targeting a .ts file. I set the download to last for 5 minutes.
Then after about 40 s I opened the file in VLC Player and it shows its length to be 42 s.
It played OK but the length display did not change and when playback reached 42 it stopped playing.
So the VLC Player is obviously not updating the length of the video once it starts playing it.
When I restarted it after a bit of checking it showed the length as 3:56 and sure enough it stopped playing at that time even though the actual video length then was 5 min!
Is there some setting in VLC to tell it to check for video length changes when playing a ts file from disk?
It might be somethiong in that case that can be used in my player program as well...
PS: I located a Record command below "Playback" but nothing happened when I clicked it, don't know what is supposed to happen though.,.. DSLast edited by BosseB; 10th Nov 2024 at 04:56. Reason: Forgot comment
-
It should work also for Windows 10 I never had this problem. I also have Version 3.0.20
Try resetting VLC or uninstall-Install again.
Did you try recording during play?
You should set the recording subfolder in advanced setting. Make sure it is a subfolder for videos because the default is for snapshots (pictures). -
Well, it seems like VLC is not keeping track of the fact that the file it is playing can be written to as it is playing it....
Therefore my program also has no way to use existing functions based on VLC to update the end position.
So the only way forward I think is to create a restart function that would work like this:
- When initially starting playback memorize the length of the video in ms
- When playing gets within say 10s of the saved length then re-open the same file and set the new end time
- Jump to the saved play position and continue playing after resetting all admin stuff:
Procedure:
- Open file for playing and if it is a ts file do:
- Make note of the duration of the video in milliseconds
- While playing, when the video playback passes the memorized duration minus say 10s do the following:
- Memorize the current play position in ms
- Reopen the same file in the player
- Position the playing location to the memorized play position
- Read the new video length
- Change the memorized video duration to the new length
- Set the new trigger point for the next reload
- Update any player visual controls according to new data (progress bar etc)
I believe that this functionality can be built into the current software using existing PasLibVlc functions. -
I have only one source, which I want to watch....
This is on my Linux server where an ffmpeg script downloads news programs to mp4 files that can be watched later (after the download finishes).
But I would like to start watching before it finishes and the mp4 format does not allow for that, an important part of the file gets written only at the point when ffmpeg closes the transfer....
So I have modified the download script to download into a ts file format and that is indeed watchable while it is being written.
The problem, though, is that all of the viewers I have tested like VNC Player and my own Videoplayer fail to update the end time of the video as it is being written and therefore the player quits when it reaches the position that represent the download size at the time the player opened the file for reading....
This is what I am struggling with now and VLC seems unable to do it.
If I immediately open the same file in the same player when it has quit then the new length shown allows further playing, but again stops down the line when that new position is reached....
I have now tested a variation of the approach given above but for some reason it feels like the VLC library has cached the state of the video file such that if I reopen it after forcing it to close then the OLD length reappears in my player!
I have tested repeatedly by opening the same file again and it still shows the same length even though new data have been added.
Waiting for a while does not help either, if I open the same file it shows the old length and not the new.
But if I open another file first and then go back to the previous file THEN the new length is shown!!!!
What is going on??Last edited by BosseB; 10th Nov 2024 at 11:36. Reason: Adding information
-
VLC works for me under Windows. I used ffmpeg to download a live stream to a TS file:
Code:ffmpeg -i https://live-manifests-ctl.warnermediacdn.com/csmp/cmaf/live/2028715/cnnfast-domestic/master_de.m3u8 output.ts
So maybe there is a setting for this but I don't know what it is. -
-
Interesting, my ffmpeg command is a lot bigger because it re-encodes the output to a fixed size and quality.
So I repeated the test you showed but for the stream I am downloading and what happens is that VLC Player can play the file while downloading but only up to the initial video duration at which time it just quits playing and exits. If I restart VLC to play it then it notes the new length and plays there.
My own videoplayer based on the VLC library does the same except if I re-open the file it keeps the original duration...
So then I checked with the posted video URL above and it behaves the same....
No way to get the file play back past the initial duration when it was loaded into VLC.
Very strange....
Similar Threads
-
How to change date and time of MP4 (or any format) video file ?
By chetan_bokhani in forum Newbie / General discussionsReplies: 5Last Post: 3rd Mar 2022, 10:11 -
Why on earth is PotPlayer playing mp4/mov/any video file like this?
By HorusOwl in forum Software PlayingReplies: 13Last Post: 19th Aug 2021, 23:11 -
Unable to convert .ts file to any video format
By Love in forum Video ConversionReplies: 9Last Post: 19th Jun 2021, 21:02 -
Video file only playing last 12 minutes
By cprostire in forum Newbie / General discussionsReplies: 3Last Post: 15th Jun 2020, 08:52 -
Movie ripped into MP4 format, but not recognized by my video-playing HDTV
By snafoo in forum Video ConversionReplies: 5Last Post: 25th May 2020, 02:22