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

Add ability to upload still to media pool #197

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

darinpope
Copy link
Contributor

This is a first pass for uploading stills to the media pool. It will need some good documentation so people don't get frustrated. I added in a couple of WARNING messages to catch the low hanging "file must end in .rgba" and if the file is not found.

For my local tests, I took one of the example PNG images available in the pool (Favorites->Example Graphics->Examples - Photos->BlackmagicStudioCamera.png) and pre-processed it with ffmpeg:

ffmpeg -i BlackmagicStudioCamera.png -vf scale=1920:1080 -pix_fmt rgba -f rawvideo ./bsc5.rgba -loglevel debug

and then did an absolute path reference to the bsc5.rgba file in the action.

Ideas for future improvements:

  • mime type verification because file extension isn't really enough
  • accept JPG and PNG and dynamically convert to RGBA to eliminate preflight process

P.S. I tried to back out the DSK related spacing changes to only have upload related in this PR, but some pre-commit items kicked in that didn't for the other PRs I've put in. Leaving it as is for now and will deal with if you want.

@Julusian
Copy link
Member

I have been intentionally avoiding implementing this because I dont like how limiting it is forced to be. Because companion doesnt have a file picker input, or a way to upload files to companion it forces actions like this to be really clunky, and very difficult to use for a large number of users. I (along with many others mostly using companionpi) configure companion from a different computer to where it is running, meaning that if I want to use this action I will have to upload the files manually to the companion machine, and then type in the correct paths to those.
We will need to figure out how to make this clear to other users

But there is demand for this, and as you have mostly implemented it, I suppose it is time for me to give in and accept it will be done this way for now.


mime type verification because file extension isn't really enough

I dont think that will be possible to do for rgba, as it isnt a proper format. inside those files is really just pixel values. It doesnt even know its own dimensions!
I think the best that can be done is to verify that the file size is the same as what we expect based on the current format of the atem (width x height x 4)

accept JPG and PNG and dynamically convert to RGBA to eliminate preflight process

I think this is something that needs to be done, or it will make this too hard to use for most. It can probably be done with sharp pretty easily, for any format that sharp supports.

@josephdadams
Copy link
Member

@Julusian what would it take to add a filepicker to the UI? We have one for importing?

@Julusian
Copy link
Member

@Julusian what would it take to add a filepicker to the UI? We have one for importing?

From a technical side, there might be something out there, but it wouldnt surprise me if there isnt anything decent. Picking a file on the server-side is a rather rare thing to want to do, definitely not something you would use on a public portion of a site.
But I would also really like this picker to have an 'upload' option, to cater to the companionpi users, which is probably also not too difficult to achieve.

I think it really comes down to motivating this functionality over other things

@josephdadams
Copy link
Member

Yeah I was thinking upload from client side, like the traditional kind

@darinpope
Copy link
Contributor Author

yeah, I was waffling on the same. I run my primary Companion instance on a Pi, so I was planning on having a local script/process on my Mac to process all the files then SFTP them up to the Pi in a known place.

I can try to dig into sharp, but I'm primarily a Java developer (with some Go) by trade, so this Javascript stuff is 🤯 for me.

@monpelaud
Copy link

Hi,
Are there any plans to merge this pr someday?
Best regards.

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

Successfully merging this pull request may close these issues.

4 participants