mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
add workaround for broken gif seeking in ffmpeg
This commit is contained in:
parent
56ad635154
commit
7cfb390e05
1 changed files with 16 additions and 0 deletions
|
@ -35,8 +35,12 @@ defmodule Philomena.Processors.Gif do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp preview(duration, file) do
|
defp preview(duration, file) do
|
||||||
|
h264_equiv = Briefly.create!(extname: ".mp4")
|
||||||
preview = Briefly.create!(extname: ".png")
|
preview = Briefly.create!(extname: ".png")
|
||||||
|
|
||||||
|
# Hack workaround for broken FFmpeg behavior which
|
||||||
|
# cannot correctly seek in GIF image files
|
||||||
|
|
||||||
{_output, 0} =
|
{_output, 0} =
|
||||||
System.cmd("ffmpeg", [
|
System.cmd("ffmpeg", [
|
||||||
"-loglevel",
|
"-loglevel",
|
||||||
|
@ -44,6 +48,18 @@ defmodule Philomena.Processors.Gif do
|
||||||
"-y",
|
"-y",
|
||||||
"-i",
|
"-i",
|
||||||
file,
|
file,
|
||||||
|
"-c:v",
|
||||||
|
"libx264",
|
||||||
|
h264_equiv
|
||||||
|
])
|
||||||
|
|
||||||
|
{_output, 0} =
|
||||||
|
System.cmd("ffmpeg", [
|
||||||
|
"-loglevel",
|
||||||
|
"0",
|
||||||
|
"-y",
|
||||||
|
"-i",
|
||||||
|
h264_equiv,
|
||||||
"-ss",
|
"-ss",
|
||||||
to_string(duration / 2),
|
to_string(duration / 2),
|
||||||
"-frames:v",
|
"-frames:v",
|
||||||
|
|
Loading…
Reference in a new issue