projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef9d12f
)
ffmpeg needs input from fifo path, not stdin
author
Mark Felder
<feld@FreeBSD.org>
Thu, 27 Aug 2020 17:47:29 +0000
(12:47 -0500)
committer
Mark Felder
<feld@FreeBSD.org>
Thu, 27 Aug 2020 17:47:29 +0000
(12:47 -0500)
lib/pleroma/helpers/media_helper.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/helpers/media_helper.ex
b/lib/pleroma/helpers/media_helper.ex
index 7e1af8bacf8d5af1750c6150cffcf84544e3f042..7c2bfbc53d48f39c627b3115176bea94c8d7a718 100644
(file)
--- a/
lib/pleroma/helpers/media_helper.ex
+++ b/
lib/pleroma/helpers/media_helper.ex
@@
-39,16
+39,16
@@
defmodule Pleroma.Helpers.MediaHelper do
def video_framegrab(url) do
with executable when is_binary(executable) <- System.find_executable("ffmpeg"),
def video_framegrab(url) do
with executable when is_binary(executable) <- System.find_executable("ffmpeg"),
+ url = Pleroma.Web.MediaProxy.url(url),
+ {:ok, env} <- Pleroma.HTTP.get(url),
+ {:ok, fifo_path} <- mkfifo(),
args = [
args = [
- "-i",
"-"
,
+ "-i",
fifo_path
,
"-vframes", "1",
"-f", "mjpeg",
"-loglevel", "error",
"-"
"-vframes", "1",
"-f", "mjpeg",
"-loglevel", "error",
"-"
- ],
- url = Pleroma.Web.MediaProxy.url(url),
- {:ok, env} <- Pleroma.HTTP.get(url),
- {:ok, fifo_path} <- mkfifo() do
+ ] do
run_fifo(fifo_path, env, executable, args)
else
nil -> {:error, {:ffmpeg, :command_not_found}}
run_fifo(fifo_path, env, executable, args)
else
nil -> {:error, {:ffmpeg, :command_not_found}}
@@
-57,7
+57,12
@@
defmodule Pleroma.Helpers.MediaHelper do
end
defp run_fifo(fifo_path, env, executable, args) do
end
defp run_fifo(fifo_path, env, executable, args) do
- args = List.flatten([fifo_path, args])
+ args =
+ if _executable = System.find_executable("convert") do
+ List.flatten([fifo_path, args])
+ else
+ args
+ end
pid = Port.open({:spawn_executable, executable}, [:use_stdio, :stream, :exit_status, :binary, args: args])
fifo = Port.open(to_charlist(fifo_path), [:eof, :binary, :stream, :out])
true = Port.command(fifo, env.body)
pid = Port.open({:spawn_executable, executable}, [:use_stdio, :stream, :exit_status, :binary, args: args])
fifo = Port.open(to_charlist(fifo_path), [:eof, :binary, :stream, :out])
true = Port.command(fifo, env.body)