Message Boards Message Boards

Can a video clip be stored in a databin and then accessed for processing?

Posted 2 years ago

I want to upload a video clip to the Wolfram cloud and then access it from the cloud for video processing in the cloud. I saved a video clip to a databin as follows - first I create a FormObject

CloudDeploy[
 FormPage[
  {"video" -> 
    QuickTime | 
     MP4}, 
  DatabinAdd[myDB, #video] &],
 Permissions -> "Public"
 ]

Then I access the URL returned by the CloudDeploy I get a form to upload a video, which I do. What I see in the databin is

Video["/tmp/UserTemporaryFiles/public/13673/4d1/4d1c2014-ae34-4e3b-\
80ba-8d2da7d6aa43/upload-directory-0/trim.5D7FEF2A-41DA-430C-B5BF-\
7C37C80997D9.MOV", Appearance -> Automatic, 
 AudioOutputDevice -> Automatic, SoundVolume -> Automatic]

I do the following in the cloud in a cloud notebook, attempting to create a Video object from the tmp file

vid = Video["/tmp/UserTemporaryFiles/public/13673/4d1/4d1c2014-ae34-4e3b-80ba-\
8d2da7d6aa43/upload-directory-0/trim.5D7FEF2A-41DA-430C-B5BF-\
7C37C80997D9.MOV"]

And I get the dreaded File not found error. So my question is - Is it possible to save a video clip as a binary object to a databin and retrieve it for video processing? It seems like the uploaded file is saved to a tmp file and then deleted before it can be accessed. So how do I achieve what I am trying to do as stated in the first sentence? Thanks much.

POSTED BY: Nitin Borwankar
2 Replies

At least this work, so looks like videos can be added to Data Drop:

v=Import["ExampleData/Caminandes.mp4"]
bin=CreateDatabin[]
DatabinAdd[bin,v]
Values[bin]

Perhaps this would be helpful: https://www.wolfram.com/datadrop/quick-reference/home

POSTED BY: Sam Carrettie

Hi Sam,

Thanks for that code. I am not sure it answers the question about a) uploading from off-cloud to on-cloud b) being able to access it on-cloud after upload for processing. If I understand the code correctly it is being run in the cloud and accessing a video clip already available in the cloud. The code I posted is being run via calling the CloudDeployed API via web client on a phone or on a laptop - video is then uploaded from device to the cloud. Then it is accessed from the cloud to process. Your code which I will try in the cloud seems to assume the video file is already in the cloud and is known to be accessible. This is slightly different.

POSTED BY: Nitin Borwankar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract