Creating a video "file" and sending it to a web server without saving it to disk

adriano.vilela
Tue, 19 Oct 2021 23:03:30 +0000
General Usage

Hi,

I’m working on a problem where I need to encode a video and send it to a web server.

I’m using VideoIO.jl to encode the video, as shown here:

https://juliaio.github.io/VideoIO.jl/stable/writing/

The link above shows two ways to encode the video: i) single-step encoding and ii) iterative encoding. In both cases, the examples show how to write the video to a file.

So, right now, what I’m doing is to encode the video to a file and, after that, I open the saved video, read its contents into an UInt8 array using the readbytes!() function, encode the array using the base64encode() function, serialize the encoded data using the JSON.json() function and then send the serialized data over to the server using the package HTTP.jl.

Since this procedure can happen quite frequently at times, I wonder if it’s possible to encode the video straight into an UInt8 array without having to save it to a file on disk first. If that’s not possible, maybe there’s a way to at least avoid flushing the contents of the “video file” to disk, maybe using something like tmpfs on Linux? Does anybody know?

Thanks a lot!

3 posts - 2 participants