This is not an issue but I would like to open a discussion on how to use ExCmd.
My use case is:
I receive chunks of videos (HLS) every 500ms from the browser in a POST endpoint.
I receive it as a File, thus %PlugUpload{path: path}.
I want to process the data with FFmpeg.
I currently data = File.read!(path) and pass the data to a process. It is a GenServer that inits Porcelain with a command that runs FFmpeg: indeed, I run the FFmpeg using the stdin buffer, so I need it to be running. FFmpeg is building HLS segments and a playlist.
My interest in ExCmd is that it seems I don't need a GenServer.
I can %Plug.Upload.give_away(FFmpegProcess, path, self()) and just pass the path.
How would you do then? The following does not run. I have no external file to output to since FFmpeg builds the segments and the playlist, passed as arguments in the command.
This is not an issue but I would like to open a discussion on how to use ExCmd.
My use case is:
%PlugUpload{path: path}
.I currently
data = File.read!(path)
and pass the data to a process. It is a GenServer that initsPorcelain
with a command that runs FFmpeg: indeed, I run the FFmpeg using the stdin buffer, so I need it to be running. FFmpeg is building HLS segments and a playlist.My interest in
ExCmd
is that it seems I don't need a GenServer.I can
%Plug.Upload.give_away(FFmpegProcess, path, self())
and just pass the path.How would you do then? The following does not run. I have no external file to output to since FFmpeg builds the segments and the playlist, passed as arguments in the command.
ExCmd.stream!(__ffmpeg_cmd__, input: File.read!(path))
I tried to add
Enum.into("")
, but I get{:error, :epipe}
.I did not add a Livebook because I am not familiar with Kino, nor how would I run some Javascript code in a Livebook.