I'm working on a project which involves capturing output from a camera via HDMI (Sony Alpha A7 IV), and projecting it via a laser/lamp projector, but the catch is that the stream which is going into the projector should be delayed by ~4 minutes. (If you start recording something at 10:00am, it will start playing back at 10:04am, etc.) It should be capturing and playing back the feed non-stop for the whole day.
First I was thinking of using FFplay to display a DirectShow stream from a HDMI capture card (like the Elgato 4K60 Pro) and opening the FFplay window on the 'projector screen', but I wasn't able to find any way to manually add delay to the stream. My second idea was to record the actual feed to a video file, and then immediately play it back in intervals (still using FFmpeg+FFplay).
Any other ideas/thoughts?
I have no idea if this idea will work but here is something you can give it a try.
I'd go along your second idea. If the stars align, you can use ffmpeg process encoding with
segmentmuxer while ffplay process decoding withconcatdemuxer.The main idea is that
segmentmuxer to produce a ~3-min video snippet (some duration shorter than the needed delay of ~4 min) after snippet throughout the day. This will give you predictable list of video files thatffplayneeds to play in a sequence. So, you can prepare the playlist accordingly.The encoder part should look something like:
You can pick any codec/format you wish. mp4/h264 is probably a sensible solution but if you want raw you can use
.nutformat as well (see the other examples in the doc). When you experiment with it, you can enable-segment_list playlist.ffconcatto see what theconcatdemuxer expects.If this display (is this an art installation?) will run for 24 hours, then you will have 480 files (assuming 3-min segments). Have all these filenames listed in the concat text and start ffplay after 4 minutes, by then the first segment should be available for playback. As ffplay plays, ffmpeg deposits new segments with prearranged file names every 3 minutes. So, you should be able to achieve continuous playback.
There is likely a way to make the delayed playback automated if you're programming all this. See the FFmpeg wiki on the topic of concatenation for more ideas.
You do need to be careful about the disk space, especially if you chose to store uncompressed video (.nut). Get a large storage or run a program on a side to delete consumed segments.
Again, I've never done this myself so I could very well be missing some details. But if I were you, this would be my first line of attack. Good luck.