SEEK and play a growing recording file

playout
client
server

#1

Has anyone managed to SEEK inside a growing file. I’m recording a DNxHD MXF with FFMPEG and can play it back even it is still recording. So far so good. But as the file length is “0” sending a SEEK > 0 crahes the playback. Recording is still running and playback from the beginning is possible as well. I’d like to do a timeshift playout.


#2

You could check out the MAV forks:
https://github.com/krzyc/CasparCG-Server/tree/2.0.x-mav
https://github.com/jstarpl/casparcg-mav

Otherwise I’m guessing you would need to modify CCG to either ignore the total duration or recheck the file at a interval.


#3

Thank for the hint. I tried the 2.0.7_MAV 8 as there is an open issue relating audio sync in MAV_9. This issue is still open since nearly 5 years. So I believe there is no support and will be no new versions based on 2.2.0 and following.

MAV_8 works pretty good. A combination of SPEED and SEEK commands combined with RESUME and PAUSE via Companion/Streamdeck makes it a pretty cheap replay machine.

Does anybody know what codec is used and if it can be changed ? It saves around 20Mbytes/s (160Mbit) to my drive which seems not too bad. But maybe there is room for improvements.

In the end I was hoping for a solution based on the main release thats more up to date and offers active support. But as you mentioned it seems that massive changes to the code are neccessary to make this possible.


#4

It uses JPEG and you can’t change it, but you can change the subsampling and quality: https://github.com/krzyc/CasparCG-Server/blob/2.0.x-mav/modules/replay/consumer/replay_consumer.cpp#L366


#5

The sampling doesn’t seam to change the filesize, and I can’t find a way to open the .mav in other software to analyse the quality. Do you know what type of container is used ? Or is the only way to access the recorded content playing it back in realtime and recording it with a FFmpeg consumer ?


#6

Looks like mjpeg packaging from the source code. Does ffprobe tell you anything?


#7

I did do some tests regarding this in the old 2.1.0 which had very crude slow-mo capabilities as well. My results with MKV files and what I think was the vp9 or vp8 codec were quite good for a proof of concept, but I never wrote any controls for it.

From what I remember this still reported a length 0? So it might just be that that version of CasparCG didn’t crash on seeking and it’s not related to codecs/containers.

Then there is the new kid on the block for replays: https://nageru.sesse.net/doc/futatabi.html
It does not support decklink in/out or interlaced but the maintainer says that can easily be done, so if you have some budget you could ask him about it.


#8

ffprobe tells “Invalid Data found when processing input”. Seems to be proprietary data that’s non standard video container.