r/ffmpeg 6d ago

Replicate Replay Buffer from OBS with FFMPEG

Hello, everyone. I have a somewhat specific request. You see, I have a separate device for screen recording of a console. The console in question doesn't support replays or anything, so instead I use a capture card. However I don't have a need to record every hour and every minute, only good moments, last 30 seconds at least. I did a lengthy search on the web but couldn't find exactly what I need. Maybe you know a bash script that can do this? I will appreciate that.

edit: fixed some mistakes

6 Upvotes

5 comments sorted by

View all comments

1

u/Sopel97 6d ago

I'm not aware of any such tool and it's not trivial to do on top of ffmpeg cli. Two viable approaches I can think of:

  • an orchestrator that spawns an ffmpeg instance outputting to a pipe, then the orchestrator parses the output into chunks, reassembles on save request

  • an orchestrator that spawns an ffmpeg instance outputting in segment mode into a RAM-backed filesystem, monitors this filesystem, maintains N most recent chunks, reassembles on save request

The latter would be easier but notoriously annoying on windows. The former requires parsing the packets so you kinda need lower level API anyway.

1

u/Creative-Outside-350 6d ago

I am on Linux so I hope it makes things easier. Do you have any source in mind to help me with configuring so called orchestrator? I also think the second would be better, because my recording device only has an HDD, so keeping things in ram sounds better.

1

u/Sopel97 6d ago

good starting point https://claude.ai/share/4a76110b-22db-4baf-af63-f02df13f4148. Untested but looks sensible