bigfoot-video-generator

A robust Elixir library for generating dynamic video content. Simplifies the process of programmatically creating videos from templates, data, and assets.

Installation

Add bigfoot_video_generator to your list of dependencies in mix.exs: elixir def deps do [

{:bigfoot_video_generator, "~> 0.1.0"}

] end

Then, run mix deps.get to fetch the dependency.

Usage Examples

This library provides a streamlined approach to video generation. Here are a few examples:

1. Simple Video Creation from a Template: elixir alias BigfootVideoGenerator.Video

template_path = "path/to/your/template.aep" output_path = "path/to/output/video.mp4"

= Video.create(template_path, output_path) |> Video.render()

case video do {:ok, %{status: "completed"}} ->

IO.puts("Video generation successful!")

->

IO.puts("Video generation failed: #{reason}")

end

2. Dynamic Data Injection into a Template: elixir alias BigfootVideoGenerator.Video

template_path = "path/to/your/template.aep" output_path = "path/to/output/video.mp4"

data = %{ title: "Elixir Rocks!", subtitle: "A Video Generated with Bigfoot" }

= Video.create(template_path, output_path, data) |> Video.render()

case video do {:ok, %{status: "completed"}} ->

IO.puts("Video generation successful with dynamic data!")

->

IO.puts("Video generation failed: #{reason}")

end

3. Asynchronous Video Rendering: elixir alias BigfootVideoGenerator.Video

template_path = "path/to/your/template.aep" output_path = "path/to/output/video.mp4"

= Video.create(template_path, output_path) |> Video.render_async()

IO.puts("Video rendering started asynchronously with job ID: #{job_id}")

Later, check the status of the job:

case Video.job_status(job_id) do {:ok, %{status: "completed", output_path: path}} ->

IO.puts("Video completed at: #{path}")

} ->

IO.puts("Video still rendering...")

->

IO.puts("Error checking job status: #{reason}")

end

4. Handling Complex Data Structures: elixir alias BigfootVideoGenerator.Video

template_path = "path/to/your/template.aep" output_path = "path/to/output/video.mp4"

data = %{ profile: %{

name: "Alice",
age: 30

}, products: [

%{name: "Product A", price: 10},
%{name: "Product B", price: 20}

] }

= Video.create(template_path, output_path, data) |> Video.render()

... (error handling as above)

5. Using with Supervisor Strategy elixir defmodule MyVideoWorker do use GenServer

def start_link(args) do

GenServer.start_link(__MODULE__, args, name: __MODULE__)

end

def init(args) do

{:ok, args}

end

def handle_info(:render, state) do

template_path = Keyword.get(state, :template_path)
output_path = Keyword.get(state, :output_path)
data = Keyword.get(state, :data, %{})

case BigfootVideoGenerator.Video.create(template_path, output_path, data) |> BigfootVideoGenerator.Video.render() do
  {:ok, _} ->
    Logger.info("Video rendered successfully!")
  {:error, reason} ->
    Logger.error("Video rendering failed: #{reason}")
end
{:noreply, state}

end

def render_video(template_path, output_path, data \ %{}) do

GenServer.cast(__MODULE__, :render)

end end

inside your supervisor

children = [ worker(MyVideoWorker, template_path: "...", output_path: "...") ]

Feature Summary

License

MIT

This package is part of the bigfoot-video-generator ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/bigfoot-video-generator/