# Veo
Veo is a utility library for Elixir designed to simplify common video processing tasks and interactions with video metadata. It provides convenient functions for extracting information, manipulating timestamps, and working with video formats.
## Installation
Add `veo` to your list of dependencies in `mix.exs`:
elixir
def deps do
[
{:veo, "~> 0.1.0"}
]
end
Then, run `mix deps.get` to fetch the dependency.
## Usage Examples
Here are a few examples demonstrating how to use `Veo` in your Elixir projects:
**1. Extracting Video Duration:**
elixir
alias Veo.Metadata
video_file = "path/to/your/video.mp4"
case Metadata.duration(video_file) do
{:ok, duration} ->
IO.puts "Video duration: #{duration} seconds"
{:error, reason} ->
IO.puts "Error extracting duration: #{reason}"
end
**2. Checking Video Format:**
elixir
alias Veo.Format
video_file = "path/to/your/video.mov"
case Format.is_mp4?(video_file) do
true ->
IO.puts "The video is in MP4 format."
false ->
IO.puts "The video is not in MP4 format."
end
**3. Converting Timestamp to Seconds:**
elixir
alias Veo.Timestamp
timestamp = "00:01:30"
case Timestamp.to_seconds(timestamp) do
{:ok, seconds} ->
IO.puts "Timestamp in seconds: #{seconds}"
{:error, reason} ->
IO.puts "Error converting timestamp: #{reason}"
end
**4. Piping Operations for Metadata Retrieval:**
elixir
alias Veo.Metadata
alias Veo.Timestamp
video_file = "path/to/your/video.mkv"
video_file
|> Metadata.creation_time()
|> case do
{:ok, creation_time} ->
creation_time
|> Timestamp.to_unix()
|> case do
{:ok, unix_timestamp} ->
IO.puts "Video creation timestamp (Unix): #{unix_timestamp}"
{:error, reason} ->
IO.puts "Error converting to Unix timestamp: #{reason}"
end
{:error, reason} ->
IO.puts "Error retrieving creation time: #{reason}"
end
**5. Validating a Video File Path:**
elixir
alias Veo.File
video_file = "path/to/your/video.avi"
case File.exists?(video_file) do
true ->
IO.puts "Video file exists."
false ->
IO.puts "Video file does not exist."
end
## Feature Summary
* **Metadata Extraction:** Easily retrieve video duration, creation time, and other relevant metadata.
* **Format Detection:** Determine the format of a video file (e.g., MP4, MOV, AVI).
* **Timestamp Conversion:** Convert between different timestamp formats (e.g., "HH:MM:SS" to seconds, and to Unix timestamps).
* **File Validation:** Check if a given video file path exists.
* **Error Handling:** Robust error handling with informative error messages.
* **Simple API:** Easy to use and integrate into existing Elixir projects.
## License
MIT
This package is part of the veo ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/veo/