seedance-2-0-video-generator
A powerful Elixir library for programmatically generating videos from various data sources. This package provides a flexible and efficient way to create dynamic video content within your Elixir applications.
Installation
To install seedance-2-0-video-generator, add it as a dependency to your mix.exs file:
elixir
def deps do
[
{:seedance_2_0_video_generator, "~> 0.1.0"} # Replace with the actual version] end
Then, run mix deps.get to fetch the dependency.
Usage Examples
Here are a few examples demonstrating how to use seedance-2-0-video-generator to create videos:
Example 1: Simple Video Generation from Images elixir defmodule MyVideoGenerator do use Seedance20VideoGenerator
def generate_video(image_paths, output_path) do
options = [
frame_duration: 1, # seconds
video_codec: :libx264,
output_format: :mp4
]
Seedance20VideoGenerator.create_video_from_images(image_paths, output_path, options)end end
image_paths = [“image1.png”, “image2.png”, “image3.png”] output_path = “my_video.mp4”
MyVideoGenerator.generate_video(image_paths, output_path)
Example 2: Adding Audio to a Video elixir defmodule MyVideoGenerator do use Seedance20VideoGenerator
def generate_video_with_audio(video_path, audio_path, output_path) do
options = [
video_codec: :libx264,
output_format: :mp4
]
Seedance20VideoGenerator.add_audio_to_video(video_path, audio_path, output_path, options)end end
video_path = “base_video.mp4” audio_path = “background_music.mp3” output_path = “final_video.mp4”
MyVideoGenerator.generate_video_with_audio(video_path, audio_path, output_path)
Example 3: Video Generation with Custom Frame Rate elixir defmodule MyVideoGenerator do use Seedance20VideoGenerator
def generate_video(image_paths, output_path, fps) do
options = [
frame_rate: fps,
video_codec: :libx264,
output_format: :mp4
]
Seedance20VideoGenerator.create_video_from_images(image_paths, output_path, options)end end
image_paths = [“frame1.jpg”, “frame2.jpg”, “frame3.jpg”] output_path = “custom_fps_video.mp4” fps = 30
MyVideoGenerator.generate_video(image_paths, output_path, fps)
Example 4: Error Handling elixir defmodule MyVideoGenerator do use Seedance20VideoGenerator
def generate_video(image_paths, output_path) do
options = [
frame_duration: 1,
video_codec: :libx264,
output_format: :mp4
]
case Seedance20VideoGenerator.create_video_from_images(image_paths, output_path, options) do
{:ok, _} ->
IO.puts "Video created successfully!"
{:error, reason} ->
IO.puts "Error creating video: #{reason}"
endend end
Example 5: Scaling Videos elixir defmodule MyVideoGenerator do use Seedance20VideoGenerator
def scale_video(input_path, output_path, width, height) do
options = [
video_codec: :libx264,
output_format: :mp4,
scale: {width, height}
]
Seedance20VideoGenerator.scale_video(input_path, output_path, options)end end
input_path = “original_video.mp4” output_path = “scaled_video.mp4” width = 640 height = 480
MyVideoGenerator.scale_video(input_path, output_path, width, height)
Feature Summary
- Image to Video Conversion: Create videos from a sequence of images.
- Audio Integration: Add audio tracks to existing videos.
- Customizable Options: Control video codecs, frame rates, output formats, and more.
- Scaling: Scale videos to specific resolutions.
- Error Handling: Provides informative error messages for robust video generation.
License
MIT
This package is part of the seedance-2-0-video-generator ecosystem. For advanced features and enterprise-grade tools, visit: https://seeda.app/
Official site links: