Moving playhead while capturing video

Hey everyone, first post and TouchDesigner noob, please be kind! :blush:

Is it possible in touch designer to

  • capture video from a blackmagic decklink (FullHD version)
  • buffer it or write it to the disk (a long to duration, say an hour)
  • while recording, move the playhead to an earlier time in the recording and play it back

I imagine this a bit like streaming, where the playheads of the clients are independently offset from the server recording the video.

I am having a hard time finding a video environment that’s able to do this, apart from Max MSP.

Is this possible in TouchDesigner?

I thought it was an interesting challenge so I just tried to build this, but I haven’t succeeded to do this in TD so far.

It seems all video file formats supported in TD (I tried Animation, Photo/Motion JPEG, MPEG 4 Part 2, H.264, GoPro-Cineform, Hap, H265) require the file to be completed before they support playback - both TD and VLC refused to load any of the videofiles while they were still being written to by TouchDesigner.

There’s the Cache TOP which can do what you want, except this saves frames only to your GPU memory, which means this method only supports very short recordings (until your GPU memory fills up, a quick test shows it needs roughly ~10GB of GPU memory for 1 minute of 25 fps at 1920x1080).

I’d be interested to hear if anybody finds a way to do this in TD.

Thanks for your reply! that mirrors the problems I was having with a lot of the other video software I was looking at! :confused:

Why not save/read numbered image sequences instead of a movie ?

You’re right Achim. Landon Thomas also suggested me to use DDS image format as this format is currently always written in uncompressed form by TD so very light on CPU to write/read each frame.

Here’s a quick example which creates a ringbuffer with 30fps of the last 100 frames captured from your webcam. It writes 100 *.DDS files on disk (so it keeps overwriting the oldest frames).It runs at 60fps on my laptop using an NVME ssd drive. Below that you’ll see a timeshifted (delayed) playback of your webcam video, read from disk.

You can expand this example very easily to create a ringbuffer which is only limited in size by your free harddiskspace. (As the frames are uncompressed I estimate it needs ~700GByte(?) for an hour of HD video)

Please note this file will continuously write and read 30 files per second of ~1 MB each to disk when you enable the ‘record’ parameter, but files are stored in the subfolder ‘frames’ for easy deletion.
ringbuffer_example.zip (4.79 KB)

1 Like

Did you test how it performs with jpgs or png

yes I did. JPG/PNG compression&decompression can only be done on CPU, that’s why they are quite a heavy load.

-only reading&decoding 1920x1080 DDS files (8Mbyte each) at 30FPS has average cooktime of 10msec on the Movie File In TOP, so TD still running happily at 60fps
-only reading&decoding 1920x1080 JPG files(0,5Mbyte each) at 30FPS has average cooktime of 73msec on the Movie File In TOP. I have to switch realtime flag off to make almost 20 FPS.

using PNG make my laptop crawl to a halt :wink:

A nice RFE would be if the Movie File Out TOP would start supporting DXT1/3/5 compression on DDS images (like HAP has and which can be decoded on GPU) next to the current lossless format, AFAIK the Movie File In Top can already decode compressed DDS images.

Another NOOB here. I am looking to record and playback a 1 hour delayed video stream as well. I have an added request to have this run 24/7 for 4 months. I will need to create files for playback then auto delete played files to clean up disk space. Can TD be programmed to do this. Will I need the Pro version or will the Commercial version be fine.
Thanks.

welcome to the forum, @Psyoptics

Can TD be programmed to do this.

Yes. Also my example is two messages above which does basically what you describe. But send me a message if you prefer someone to spec & build a client-ready version for you.

Will I need the Pro version or will the Commercial version be fine.

Commercial is fine

Will I be able to clean the files automatically so this can run for 4 months 24/7 automatically? I am repurposing a High powered Watchout server to run Touch Designer and have a Commercial License. I will use a NDI camera at either 15fps or 30fps feeding a small HD (1920x 1080).