CasparCG / server

CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
GNU General Public License v3.0
912 stars 268 forks source link

Playback of growing files #918

Open dimitry-ishenko opened 6 years ago

dimitry-ishenko commented 6 years ago

I've got a .ts file that is being written to and played back at the same time. Running server 2.1 Beta 2.

Currently the server will stop playing at the point where the end of the file was when the playback has started. In other words, if the file was 5 minutes long, when I started playing it, the server will stop at the 5 minute mark, even though by the time it reaches that mark, the file will be 10 minutes long.

I understand all efforts currently go into stabilizing 2.2, but we've been successfully using 2.1 Beta 2 in our production environment. We have a show coming up on Saturday, where I need to be able to play the above file.

My question is:

  1. Can someone think of a simple workaround that does not involve patching/recompiling the server?

  2. Failing that, can someone think of a simple way to patch the server to allow such behavior?

dimitry-ishenko commented 6 years ago

As a starting point I was thinking if I pass 0 length and tweak this line: https://github.com/CasparCG/server/blob/6fec6f8f6b5276db86536dd551e047f2a8f3dcdb/modules/ffmpeg/producer/input/input.cpp#L366

to read : ... || (file_frame_number_ >= out_ && out_ > 0) ...

dimitry-ishenko commented 6 years ago

Well, the above change is indeed sufficient to keep the ffmpeg producer going. I can submit it as a PR, but it feels a bit hackish. Thoughts?

premultiply commented 6 years ago

I like the idea of explicitly setting LENGTH 0 to keep the producer running until manually stopped.

If LENGTH is not set at all it should auto-remove the producer (empty layer) or transition to the next loaded clip after last frame was played.

Negative values to LENGTH should set relative out-points from the last frame.

TomKaltz commented 6 years ago

I have tested in latest build that growing MXF files will report 0 length and play indefinitely.

premultiply commented 6 years ago

Means you played an open and incomplete MXF file and ffmpeg reported length 0 by itself? Which mxf writer was involved here?

TomKaltz commented 6 years ago

I played back same file that was being recorded by ffmpeg consumer. Dnx Mxf.

premultiply commented 6 years ago

Huh, I did not know that ffmpeg handles MXF containers correctly in this way ^^ Then you should be able to do timeshift, instant replay and slowmotion with ffmpeg without additional stuff. I think just the framerate producer has to re-added. But its framerate filter may be swapped by minterpolate filter which should have better quality. ;-)