Table of Contents
Zig FFI bindings for FFmpeg (libavformat, libavcodec, libavutil).
High-performance Zig interface for video/audio metadata extraction and format operations. Replaces subprocess calls to ffprobe/ffmpeg with direct library bindings.
const ffmpeg = @import("zig-ffmpeg-ffi");
var info = try ffmpeg.probe(allocator, "video.mp4");
defer info.deinit();
std.debug.print("Duration: {d:.2}s\n", .{info.duration_seconds});
std.debug.print("Format: {s}\n", .{info.format_name orelse "unknown"});
for (info.streams) |stream| {
if (stream.stream_type == .video) {
std.debug.print("Video: {}x{} @ {d:.2}fps\n", .{
stream.width orelse 0,
stream.height orelse 0,
stream.frame_rate orelse 0,
});
}
}#include "ffmpeg_ffi.h"
FFIMediaInfo* info = ffmpeg_probe("video.mp4");
if (info) {
double duration = ffmpeg_get_duration(info);
int64_t bitrate = ffmpeg_get_bitrate(info);
uint32_t count = ffmpeg_get_stream_count(info);
for (uint32_t i = 0; i < count; i++) {
CStreamInfo stream;
if (ffmpeg_get_stream(info, i, &stream)) {
// Use stream.width, stream.height, etc.
}
}
ffmpeg_free(info);
}This library was inspired by panoptes video analysis needs. See PROVENANCE.md for details.