Caspar Replay – Download

I promised that I would release my replay client and the source code when I had the time to clean up the code and test the functionality. I’ve come to realize that I probably never will have time to write good-looking source code, but I’ve at least tried-out and evaluated the replay client a couple of times now, and I think it works fairly well. My biggest problems right now are actually that Caspar crashes sometimes…

So here it is: Caspar_replay, version 2015-02-07, released under the ISC licence.

If you have any questions feel free to leave a comment or contact me.

Cheers! /Johan

Advertisements

Caspar replay: CPU-usage

Some guys at the forum asked about the cpu usage, so I made some tests today to figure out how much impact the different things involved does.

cpu usage for caspar replay

 

During the tests I got the values:

 

With windows (screen consumers) open: cpu load
idle 20%
play input video on 4 channels 44%
record on 4 channels + playback on 1 channel 55%
play slowmo (continously seeking) 65%

 

Without windows (screen consumers): cpu load
idle 12%
play input video on 4 channels 19%
record on 4 channels + playback on 1 channel 31%
play slowmo (continously seeking) 49%

It’s obvious that having the windows open has a certain impact on the cpu load. Since the maximum cpu load is only 49% in the last case, maybe it would be possible (on my machine) to record on 8 channels.. THAT would be an interesting development, watch your back, EVS! 🙂

Using CasparCG for replay/slowmo/EVS replacement

Here’s a small heads-up on what I’m currently working on!

A couple of months ago I got some hints that my now-favorite program CasparCG could (maybe) be used to play replays of live-streaming media. This is something that has traditionally been out of scope for productions with smaller budgets.

So, if one could be able to control Caspar to do it, that would be really neat, right?

There has been some an ongoing thread in the caspar forum about this, but it has been focused on creating a really-good, and by doing that creating custom consumers in Caspar and, to be honest, that’s a bit out of my league right now..

So, out of curiosity, I’ve followed the development last year and made some own tests on different solutions on my own:

Try 1: VLC and CasparCG

The idea is to use Caspar to record video files in ffvhuff-format (because of the big advantage of being able to read from the file at the same time as writing to it), and playback the file using VLC (because it can play back videos at slow-motion rates, and seek in good ways). I created a web-interface to VLC and managed to get the whole thing working quite okay, with some drawbacks:

  • The video and sound got out-of-sync after a while
  • The vide files seemed to get corrupt sometimes. That’s NOT a good thing, when you’ve recorded several hours of video and suddenly lose it all…
  • The video file got HUGE really fast, about 2GB/min. But that’s okay I guess…
  • It took lots of CPU to record and playback, I never even began with working on several record channels.

I never was able to solve these problems, so eventually I moved on with other projects.

Try 2: Vanilla CasparCG and a good controller

A couple of weeks ago I put together some requirements a replay/slowmo solution would need to have to be usable:

  1. Be able to record several channels at the same time, in real time. The ideal would be 4, but 3 or 2 would be okay too.
  2. Playback a channel a any rate, backwards and forwards, and to be able to seek any specified time in the channel.
  3. For interviews: Playback sound in sync with video.
  4. Be able to run it on an ordinary (well, somewhat ordinary…) computer.

My idea was to use a vanilla (unaltered) version of caspar, because it would be; a) easier to develop just a controller, and b) it would problably be more stable than a separate, custom-coded version.

This time I’ll try to get Caspar to record the input-channels to h264, and then play back these files. Because h264-files can’t be read from when writing to them I’ve come up with a rather clever solution, if I may say so! 🙂

So instead of recording each frame as a jpeg, (where you need to code the record/playback-code ourselves, and need to worry about audio-sync) or use ffvhuff (which turned out to be unreliable) I’m writing h264-files, and when the play-head needs to access a file that is currently being written to, the record-head finishes writing to that file and begins recording to a new file!

I’ve managed to create a Caspar controller that together with a completely unaltered version of Caspar fulfills my requirements-list above, with some exceptions:

  1. Yeah, with some drawbacks:
    * There is a slight gap (ca 200ms) between the recorded files, but to cope with that I’ve implemented an “exclusive record” feature, so that when doing interviews and such, the recording won’t be interrupted.
    * Another drawback is of course that we shouldn’t be playing-back anywhere to close to real-time, as this would divide the recording into many small pieces, with gaps between them. But if we’re 10s+ behind, no problem!
  2. Yeah, somewhat. Caspar can SEEK to any place in the h264-files, but Caspar doesn’t support playback at any other rate than 1. If we want to do slowmo’s or go backwards we can SEEK the playhead to the correct position in the timeline many times per second, and we’ll get an acceptable smooth playback at any speed and direction.
  3. Yes! Output is with synced audio!
  4. Yes! On my somewhat beefy computer (Intel i7 4770k, that’s 4 cores @ 3.5GHz) I’m running simultaneous record (on 4 channels) and playback (1 channel) for 720p25 input, CPU running steadily at ~50%, which is fine. It’s the CPU that’s limiting here, and I’m recording and playing from an ordinary mechanical hard-drive. The video takes up about 4GB per channel and hour.

Here’s a screenshot of when I’m recording on 4 channels (the 4 lower windows), and playing back the 3rd channel simultaneously, on channel 1.

creplay_1

 

So to sum it up, this is a replay/slowmo/EVS-replacement solution that’s using:

Software:

  • CasparCG
  • Controller-client programmed in Flash

Hardware:

  • A PC with good CPU. 4 channels 720p25 is proved to work on i7 4770k, lower speced pc:s should be able to run great with fewer channels as well.
  • Mechanichal hard drive – no SSD-disks needed!
  • Decklink cards for video in/output.

I’m planning on releasing the client, source code and more specs in a couple of weeks, but I’m going to try this out in some real productions first! 🙂