ai-jiggle-video

A helpful Elixir library for programmatically applying subtle, randomized movements to video frames, creating a "jiggle" effect. This can be useful for adding dynamism or simulating hand-held camera footage.

Installation

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

{:ai_jiggle_video, "~> 0.1.0"} # Replace with the actual version

] end

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

Usage Examples

This library provides functions to manipulate video frames based on configurable parameters. Here are a few examples:

1. Basic Jiggle: elixir frame = %{width: 640, height: 480, data: "binary_frame_data"} # Example frame data

jiggled_frame = AiJiggleVideo.jiggle_frame(frame)

jiggled_frame now contains the modified frame data.

2. Custom Jiggle Intensity: elixir frame = %{width: 640, height: 480, data: "binary_frame_data"}

jiggled_frame = frame |> AiJiggleVideo.jiggle_frame(%{intensity: 0.75}) # Intensity between 0.0 and 1.0

jiggled_frame now contains the modified frame with the specified intensity.

3. Applying Jiggle to a Sequence of Frames (using Enum.map): elixir frames = [%{width: 640, height: 480, data: "frame_1"}, %{width: 640, height: 480, data: "frame_2"}]

jiggled_frames = frames |> Enum.map(&AiJiggleVideo.jiggle_frame(&1, %{intensity: 0.5, frequency: 2}))

jiggled_frames now contains the list of modified frames.

4. Pattern Matching for Specific Frame Types: elixir defmodule VideoProcessor do def process_frame(%{type: :i_frame, data: data} = frame) do

AiJiggleVideo.jiggle_frame(frame, %{intensity: 0.8})

end

def process_frame(frame) do

# Handle other frame types (e.g., P-frames, B-frames) without jiggle
frame

end end

frame = %{type: :i_frame, width: 640, height: 480, data: "i_frame_data"}

jiggled_frame = VideoProcessor.process_frame(frame)

5. Piping with Custom Configuration: elixir frame = %{width: 640, height: 480, data: "binary_frame_data"}

jiggled_frame = frame |> AiJiggleVideo.configure_jiggle(%{intensity: 0.6, x_offset: 5, y_offset: 3}) |> AiJiggleVideo.jiggle_frame()

Feature Summary

License

MIT

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