lulzsun / RePlays

Open-source game recording management software
GNU General Public License v3.0
162 stars 18 forks source link

Instant replay / Replay buffer capturing #47

Closed N72826 closed 1 month ago

N72826 commented 2 years ago

Hey I really appreciate you for creating this. MedalTV is functional but I have a feeling their premium is going to drive it into the ground. They already made it so you can't download your uploaded clips without a watermark without paying. They also "temporarily" disabled embedding on discord, which is ridiculous.

Are there any plans to implement a clip feature that allows you to capture the last x seconds?

I see you are using OBS to perform the capturing, and what I am asking for may be extremely difficult because of this. I believe that the way this feature works is through recording all the time and deleting the recorded content that wasn't marked for capture with the chosen hotkey. I am unsure how this would be accomplished but it would truly make this platform a superior alternative to Medal.

sonicv6 commented 2 years ago

This should be possible, I've got a few other things I'd rather do before working on this but someone else might take it up.

N72826 commented 2 years ago

This should be possible, I've got a few other things I'd rather do before working on this but someone else might take it up.

oh nice! I will definitely be watching this project closely. Thank you and everyone else who works on this!

sonicv6 commented 2 years ago

Leave the issue open so we remember it haha

N72826 commented 2 years ago

Leave the issue open so we remember it haha

oh shit my bad lol

lulzsun commented 2 years ago

OBS does have a replay buffer feature already built in, so yes, this implementation isn't too difficult. It's actually common in these types of applications.

This will probably be implemented eventually, but as sonicv6 said, it may be awhile until it does because of other priorities. But I'll try to keep it in mind.

candroid-man commented 1 year ago

I downloaded this app because that's what I thought this would do 😆

I would much rather use RePlays to handle Replay Buffer because you have a built-in editor that is super simple. With OBS, I have to get the file, open like DaVinci Resolve or something, edit the video, render it, upload it to PeerTube, share. With RePlays I would like to have a similar experience to Medal.tv, where you just hit F8 to save 1–5 minutes of gameplay, edit the file quickly and upload it immediately. Also, when you implement this, be sure to allow the user to save both files locally (the clipped version and the full file)

eiqnepm commented 1 year ago

This is a really nice app! No account registration and a simple yet effective interface. The app doesn't use too much resources in the background either, I'm looking at you memory hog Medal.

I've just been playing around with it. If all you wanted to do was record whole game sessions, it's great!

Unfortunately for me, I would require push to talk and a reply buffer to use it as my primary recording software. Alas I'm stuck with Medal for now.

I'll watch for any updates on this though.

Segergren commented 1 year ago

@lulzsun Have you looked into it? If so, are there any part that is extra hard to implement? I tried to look into it about a month ago but my limited DLL/C++ skills were not enough.

lulzsun commented 1 year ago

It is in progress and I have got it working in an example here: libobs.NET

However, I have not decided to implement it yet because I currently want to focus on refactoring, specially the recording back-end and the keybinding system (doing this right now as we speak). Once I feel satisfied with the refactoring, I will be ready to implement instant replay.

Nama commented 1 year ago

I really thought that this would be the main reason this app exists and was confused about the lack of options for this XD

josc19 commented 1 year ago

Currently looking for a shadow play alternative that just works, shadowplay recently started to just randomly fail to load and I have no insight on what happened. I usually document bugs and crashes i run into a game im testing. OBS replay buffer is just silly since it doesn't clear the buffer on save. Medal is just gross im not touching that.

I really hope this feature becomes a thing soon.

lulzsun commented 1 year ago

This feature is up next on my personal TO-DO list, it's just that recently I have been busy with things unrelated to this project. I'm unable to give a time frame on when I can get around implementing this, but I promise that this is the number one priority feature to complete once I am able to find some time.

There has already been work and tests on buffer capturing using the libobs.NET library that I work on alongside this project, so all it needs is a proper implementation.

Bmilner88 commented 10 months ago

Don't know if this is the right place to ask this, but when/if this gets implemented, will the files be Sessions? Or Clips?

I ask because I'm curious if the files will be editable after they are captured

sonicv6 commented 10 months ago

Under the hood there's no major difference but it makes more sense for us to make them sessions precisely so you can edit them.

sshcrack commented 7 months ago

@lulzsun is the refactoring done? If so, would you be open to receive a pull request for this feature? Haven't looked at the libobs bindings yet but I think the methods are already implemented right?

lulzsun commented 7 months ago

Yes, I did finish most of the refactoring, just haven't had the time to do a proper implementation of this feature. Feel free to draft a pull request for this and I may be able to assist if needed.

I did test and implemented the methods required for buffer capturing, there is an example of this provided here if you want to use as a reference:

https://github.com/lulzsun/libobs-sharp/blob/d4e990a5fb1c2df4383191e7eefa827d438d5a2a/libobs-sharp.example/Program.cs#L116-L127

// SETUP NEW BUFFER OUTPUT (OPTIONAL, just demonstrating it here in example that multiple outputs can be run)
IntPtr bufferOutputSettings = obs_data_create();
obs_data_set_string(bufferOutputSettings, "directory", "./");
obs_data_set_string(bufferOutputSettings, "format", "%CCYY-%MM-%DD %hh-%mm-%ss");
obs_data_set_string(bufferOutputSettings, "extension", "mp4");
obs_data_set_int(bufferOutputSettings, "max_time_sec", 15);
obs_data_set_int(bufferOutputSettings, "max_size_mb", 500);
IntPtr bufferOutput = obs_output_create("replay_buffer", "replay_buffer_output", bufferOutputSettings, IntPtr.Zero);
obs_data_release(bufferOutputSettings);

obs_output_set_video_encoder(bufferOutput, videoEncoder);
obs_output_set_audio_encoder(bufferOutput, audioEncoder, (UIntPtr)0);

https://github.com/lulzsun/libobs-sharp/blob/d4e990a5fb1c2df4383191e7eefa827d438d5a2a/libobs-sharp.example/Program.cs#L136-L149

// START BUFFER OUTPUT
bool bufferOutputStartSuccess = obs_output_start(bufferOutput);
Console.WriteLine("buffer output successful start: " + bufferOutputStartSuccess);
if (bufferOutputStartSuccess != true) {
    Console.WriteLine("buffer output error: '" + obs_output_get_last_error(bufferOutput) + "'");
}

// SAVE REPLAY BUFFER
Task.Run(async () => {
    await Task.Delay(5000); // Record for 5 seconds
    calldata_t cd = new();
    var ph = obs_output_get_proc_handler(bufferOutput);
    Console.WriteLine("buffer output successful save: " + proc_handler_call(ph, "save", cd));
});
sshcrack commented 4 months ago

The PR has been merged, can we close this issue?

lulzsun commented 1 month ago

Forgot to close this, closing now.