Slide 15
Slide 15 text
Example, Usage...
def generate_thumbnails(video, interval) do
FLAME.call(MyApp.VideoRunner, fn
- >
tmp = Path.join(System.tmp_dir!(), Ecto.UUID.generate())
File.mkdir!(tmp)
System.cmd("ffmpeg", [
"-i", video.url, "-vf", "fps=1/
# {
interval}", "
# {
tmp}/%02d.png"
])
urls = Storage.put_thumbnails(video, Path.wildcard(tmp
< >
"/*.png"))
Repo.insert_all(Thumb, Enum.map(urls, &%{video_id: video.id, url: &1}))
end)
end