Plant-Tracer / webapp

Client and Server for web-based JavaScript app
GNU Affero General Public License v3.0
0 stars 2 forks source link

Upload: Downscale movie on upload #546

Open sbarber2 opened 2 weeks ago

sbarber2 commented 2 weeks ago

There will probably always be a MAX_FILE_UPLOAD size to limit the size of uploaded movies.

It would be handy if the webapp offered the option to and/or automatically downscaled an uploaded movie to be either a specified resolution or specified (or default) file size.

Obviously the above specification sentence is like 3 or 4 separable features in one sentence, so part of the work here is to further elaborate the specification of this feature set.

simsong commented 2 weeks ago

The problem is that you need to downscale it before it is uploaded. Right now it is uploaded directly to S3, so there’s really no need to have a limit. S3 can handle it. It’s actually about usability of the uploads, the playing, and time spent splitting up the movie, and the storage costs.

On Oct 10, 2024, at 11:05 AM, Steve Barber @.***> wrote:

There will probably always be a MAX_FILE_UPLOAD size to limit the size of uploaded movies.

It would be handy if the webapp offered the option to and/or automatically downscaled an uploaded movie to be either a specified resolution or specified (or default) file size.

Obviously the above specification sentence is like 3 or 4 separable features in one sentence, so part of the work here is to further elaborate the specification of this feature set.

— Reply to this email directly, view it on GitHub https://github.com/Plant-Tracer/webapp/issues/546, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFHLDFDMAJCLJNTC2PPHDZ22JSBAVCNFSM6AAAAABPXAFZASVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3TSMJTGU4TEMQ. You are receiving this because you are subscribed to this thread.

sbarber2 commented 2 days ago

The problem is that you need to downscale it before it is uploaded.

Could we could downscale via the webapp server process before saving it to S3? Save it to a temp file or in-memory and call ffmpeg to reduce the resolution? Then save the result to S3?

sbarber2 commented 2 days ago

One of the issues that comes to mind is how to choose the downscaled resolution.

I mean, the 320x240 sample videos we have work nicely with the current tracker, but is there some theoretical guideline to use? Or at least a systematically vetted empirical one?

I suspect it's less an absolute frame size and more a percentage reduction from the originally presented file's resolution with some kind of floor resolution, but I don't know.

sbarber2 commented 2 days ago

So that possibilities for a sub-feature set here would be:

simsong commented 2 days ago

The issue isn't resolution, the issue is how much change there is between frames in what is being tracked. Our current algorithms seem to like ~ 1 pixel of movement between frames. So faster plant movement will want higher resolution, or a higher frame rate.

Separately, we have the display resolution. We are currently displaying at 1:1, so high-res movies take up a lot. But we could always display at, say, 512 pixels across.

simsong commented 2 days ago

The problem is that you need to downscale it before it is uploaded.

Could we could downscale via the webapp server process before saving it to S3? Save it to a temp file or in-memory and call ffmpeg to reduce the resolution? Then save the result to S3?

Yes, but you would need to do that on the client. We are uploading from the client directly to S3.