Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] export replay as MP4 #9823

Open
samejima-san opened this issue Oct 5, 2023 · 11 comments
Open

[Feature request] export replay as MP4 #9823

samejima-san opened this issue Oct 5, 2023 · 11 comments

Comments

@samejima-san
Copy link

it would be much easier to share replays on the internet if there were an export replay as MP4 so I could download the video and post it wherever I see fit.

@ISenseAura
Copy link

is this feature worth working on? i mean will it get accepted by the PS devs if i create a system that exports replay in html format to mp4? @KrisXV

@shrianshChari
Copy link
Contributor

I would personally advise you to use OBS or some other screen recorder in case this feature request doesn't pan out.

@ISenseAura
Copy link

ISenseAura commented Jan 5, 2024

I somehow managed to convert the HTML replay to a decent (could be better) quality video (without sound).
It requires the HTML file to autoplay the replay, that is, the battle replay should start as soon as the page loads.
It approximately takes 1 minute to convert a replay into video of duration 30 seconds.

Your thoughts on this @DaWoblefet ?
Should I start working on implementing It in the server or do we not need it?

@DaWoblefet
Copy link
Member

DaWoblefet commented Jan 5, 2024

I won't definitively say no, but I can't think of there being much value in exporting replays as video files. Playback on replays is pretty intuitive, and you can already download replays. Sharing replays is as easy as sharing the URL. I would think managing a video file would be more difficult than just passing around a URL (e.g. Discord and Twitter disallow uploading large files, which longer replays will easily reach). If such a feature existed it would also likely need to be rate limited somehow, or processed entirely client-side so malicious actors couldn't just spin up a bunch of video request on 1000-turn replays. For all those reasons, I would not recommend proceeding with it.

@ISenseAura
Copy link

ISenseAura commented Jan 6, 2024

I won't definitively say no, but I can't think of there being much value in exporting replays as video files. Playback on replays is pretty intuitive, and you can already download replays. Sharing replays is as easy as sharing the URL. I would think managing a video file would be more difficult than just passing around a URL (e.g. Discord and Twitter disallow uploading large files, which longer replays will easily reach). If such a feature existed it would also likely need to be rate limited somehow, or processed entirely client-side so malicious actors couldn't just spin up a bunch of video request on 1000-turn replays. For all those reasons, I would not recommend proceeding with it.

I understand, but 1000 turns replays are rare and we can definitely put a size limit for the video (like 25-30MB). The size of replay video will not be that large, for example a 20 secs video was of size 600KB and it takes around 4-7 secs to complete one turn in a battle replay.
(Again this is all rough considerations)

So by considering the worst case scenario (that is each turn taking exactly 7secs to complete) and doing the rough calculation, the size of a 100 turns replay will be 21MB and duration will be 12mimutes 28 seconds.

And im sure most users, at some point, wished there was a feature to export the battle replay as video so that they can share it with their friends.
I know sharing the URL is more easy but sharing video file has its own advantage like you or your friends don't have to leave the app where it was shared.

OR
I could just create a separate tool on the internet that converts replay to video but yeah users will find it lazy to download the replay, visit the tool, upload replay, wait for it to convert and then download the video file.

@Zarel
Copy link
Member

Zarel commented Jan 7, 2024

I would be interested in merging such a feature, but:

  1. it would need to be clientside (it would be a DoS vector if it were serverside)

  2. it would need not to affect load time (maybe only have it download the files for it after you click the button?)

@ISenseAura
Copy link

ISenseAura commented Jan 7, 2024

ah no,
@Zarel it uses timesnap and puppeteer to open a web page, take screenshots of the content (in our case the battle replay) and stores the screenshots in a folder and then it uses ffmpeg to encode those screenshots into a video and ofcourse it deletes the screenshots folder after the conversion is done.

We don't have to interact with a browser for all these processes to take place.

My idea is to implement it directly into the server
OR
we can build a separate API (an external application) and have the PS replay player interact with the API when someone requests a video of the replay.
The idea is to provide a "Download As Video" button on the replay player, after clicking the button PS will upload the html replay to the API and in response it will get a link of the converted video so that the user that requested it can download the video using the link.

here is an example output video.
Size : 2.1 MB
Battle Turns : 9
Duration : 1 Minute
Time Required For Whole Process : 3 Minutes

  • i made it record only the battle field. for some reasons the sprites move faster than they originally do.
  • It doesn't record audio i just didn't try it yet, but we can definitely implement that too.
  • we can record in high quality also but size and time required will be increased in that case.
video.mp4

@Zarel
Copy link
Member

Zarel commented Jan 9, 2024

Hm. That sounds like it's best fit for a third party downloader website, like one of those YouTube downloader sites. I'd be willing to link to it from replay pages, but I definitely wouldn't want to host it on our own infra; it's a bit of a maintenance nightmare.

@ISenseAura
Copy link

Hm. That sounds like it's best fit for a third party downloader website, like one of those YouTube downloader sites. I'd be willing to link to it from replay pages, but I definitely wouldn't want to host it on our own infra; it's a bit of a maintenance nightmare.

Yes, I understand.
I will be the one hosting it.

Also, I've been doing some research lately and I think I can make this feature client side totally.
I don't guarantee it but I will let you know anytime soon if that happens.

@samejima-san
Copy link
Author

Hm. That sounds like it's best fit for a third party downloader website, like one of those YouTube downloader sites. I'd be willing to link to it from replay pages, but I definitely wouldn't want to host it on our own infra; it's a bit of a maintenance nightmare.

i think it would work best as a browser extension honestly. ill look into it

@Intenzi
Copy link

Intenzi commented Feb 10, 2024

I have a working project in my profile of the same. Feel free to look into it if that can be of any help on how to go about it 🙇
Like ISenseAura specified, puppeteer can be utilized. A browser extension can also be made that utilizes screenshots / directly screen recording of replays!
It would be best kept as a 3rd party extension I agree, links are far easier to share in forums :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants