How to keep playing / play the end of a file that's still recording?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Karyudo
New Cone
New Cone
Posts: 2
Joined: 06 Dec 2020 04:01

How to keep playing / play the end of a file that's still recording?

Postby Karyudo » 06 Dec 2020 08:17

I record F1 from TV using Emby, and stream that to some friends via Discord, using VLC.

If I start playing a transport stream (TS) that's still being recorded/written to by Emby, then VLC seems to use the length of the file when it's first opened, and never makes it any longer—even though I can see that the file's getting written to.

If I make a copy of the newly-longer file, then VLC happily uses the new length—but still won't recognize that the original, still-recording file is longer than it was when VLC first opened it.

For example, if I start playing the recording when the race is on lap 10, I can only ever play to lap 10, even though the file is continuing to record. Even after the whole race is done, and the file is no longer being written to, I can still only play to lap 10.

How can I get VLC to essentially "stream" the file, and keep the end point moving outward as the file keeps getting longer? Or at least re-determine the end of the file, if I re-open it?

Rémi Denis-Courmont
Developer
Developer
Posts: 15312
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to keep playing / play the end of a file that's still recording?

Postby Rémi Denis-Courmont » 06 Dec 2020 09:53

There is no one-size-fits-all answer here. Some file formats cannot be played at all while recording, and some file systems won't even allow VLC to read the file if another process is writing it.

In most other cases, VLC will stop playing when it reaches the end. so you have to ensure that the recording speed is no slower than the playback speed. That's how it's supposed to work for TS.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Karyudo
New Cone
New Cone
Posts: 2
Joined: 06 Dec 2020 04:01

Re: How to keep playing / play the end of a file that's still recording?

Postby Karyudo » 06 Dec 2020 17:23

OK, I think I understand both of those statements, but I'm not sure either applies in my case.

With respect to Statement One, I know that VLC *can* play the file while it's recording, and the file system *does* allow VLC to read the file while another process is writing to it. So that suggests Statement Two ("most other cases") applies.

Statement Two says "VLC will stop playing when it reaches the end," which seems self-evident. Statement Two says that recording speed has to be no slower than playback speed, which also seems self-evident. In my case, neither of these ideas is violated. I'm not "catching up" to the end of a still-recording file, and I would not be surprised if VLC stopped playing at the true end of a file.

Instead, what I'm seeing is that VLC is using the length of the still-lengthening file when it's first played as the only, unchanging length of the file. If I try playing a still-recording file after 30 minutes, VLC will only ever play the first 30 minutes of that file, even if the file keeps recording for 60 minutes. If the recording finishes after 60 minutes, VLC will "think" it is only 30 minutes long, and only play the first 30 minutes. However, if I make a copy of the exact same "finished recording after 60 minutes" file that only plays for 30 minutes, and play the copied file, then VLC will suddenly "see" that it's 60 minutes, and play all 60 minutes. That doesn't make sense

I think this implies that VLC must be doing something like caching file information the first time something is played that is not updated when the same file is played again, which seems like a bug. Does this help with any troubleshooting?


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 42 guests