Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Thumbs.db
# IDE
.vscode/
.idea/
.kiro/
*.swp
*.swo

Expand All @@ -29,4 +30,4 @@ src/vendor/
temp/

# Keep important files
!LICENSE
!LICENSE
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2024-12-10

### Added
- **Interactive Mode**: Step-by-step wizard for media generation
- Media type selection (video/audio) with clear prompts
- Parameter configuration with validation and default values
- Configuration summary and confirmation before generation
- Real-time progress feedback during media creation
- Robust input handling with error recovery
- Support for both experienced and novice users

- **Enhanced User Experience**
- User-friendly prompts with clear instructions
- Input validation with helpful error messages
- Default value suggestions for quick configuration
- Graceful handling of invalid input with retry options

### Enhanced
- **CLI Interface**: Maintained full backward compatibility
- **Error Handling**: Improved error messages and recovery
- **Cross-platform Support**: Enhanced terminal compatibility

### Technical
- **Input System**: Redesigned input handling using std.io.getStdIn().reader()
- **Validation**: Comprehensive input validation and sanitization
- **Memory Management**: Improved memory handling for interactive sessions
- **Testing**: Added comprehensive unit and integration tests for interactive mode

## [0.1.0] - 2025-10-11

### Added
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A fast, cross-platform command-line utility for generating test media files with

- 🎬 **Video generation** with animated countdown timer
- 🎵 **Audio generation** with customizable sine wave test tones
- 🧙‍♂️ **Interactive mode** - Step-by-step wizard for easy configuration
- 🎯 **Multiple formats** - MP4, AVI, MOV, MKV, MP3, WAV, AAC, FLAC
- ⚙️ **Highly configurable** - resolution, bitrate, duration, codecs, frequency
- 🚀 **Cross-platform** - Windows, macOS, Linux (Intel & ARM)
Expand All @@ -37,6 +38,14 @@ Download the latest release for your platform:

### Basic Usage

#### Interactive Mode (Recommended for New Users)
```bash
# Launch interactive wizard - guided setup with prompts
./media-gen i
```
*Perfect for beginners or when exploring different options. The wizard guides you through each step with helpful prompts and default values.*

#### Command Line Interface (CLI)
```bash
# Generate a 10-second countdown video
./media-gen video --duration 10 --output countdown.mp4
Expand All @@ -50,6 +59,21 @@ Download the latest release for your platform:
# Show help
./media-gen help
```
*Ideal for automation, scripting, or when you know exactly what parameters you need.*

#### When to Use Each Approach

- **Use Interactive Mode** when:
- You're new to media-gen
- You want to explore different configuration options
- You prefer guided setup with validation
- You need help understanding available parameters

- **Use CLI Mode** when:
- You're automating media generation
- You know the exact parameters you need
- You're writing scripts or batch operations
- You prefer direct command execution

## 📖 Usage Guide

Expand Down Expand Up @@ -285,9 +309,9 @@ chmod +x media-gen
### Getting Help

- 📖 Check this README for usage examples
- � Breowse [EXAMPLES.md](EXAMPLES.md) for comprehensive scenarios
- � [Reqport bugs](https://github.com/DimazzzZ/media-gen/issues)
- � [Rtequest features](https://github.com/DimazzzZ/media-gen/issues)
- Browse [EXAMPLES.md](EXAMPLES.md) for comprehensive scenarios
- [Report bugs](https://github.com/DimazzzZ/media-gen/issues)
- [Request features](https://github.com/DimazzzZ/media-gen/issues)
- 💬 [Start a discussion](https://github.com/DimazzzZ/media-gen/discussions)

## 📄 License
Expand All @@ -302,4 +326,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file

---

**Made with ❤️ for developers who need reliable test media files**
**Made with ❤️ for developers who need reliable test media files**
7 changes: 7 additions & 0 deletions src/cli.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub fn printHelp() !void {
print("Commands:\n", .{});
print(" video Generate video file with countdown timer\n", .{});
print(" audio Generate audio file with test tones\n", .{});
print(" i, interactive Interactive mode - guided setup\n", .{});
print(" help Show this help message\n\n", .{});
print("Video options:\n", .{});
print(" --width <width> Video width (default: 1920)\n", .{});
Expand Down Expand Up @@ -66,6 +67,12 @@ pub fn parseAndExecute(allocator: std.mem.Allocator, args: [][:0]u8) !void {
return;
}

if (std.mem.eql(u8, args[1], "i") or std.mem.eql(u8, args[1], "interactive")) {
const interactive = @import("interactive.zig");
try interactive.run(allocator);
return;
}

if (std.mem.eql(u8, args[1], "video")) {
var config = VideoConfig{};
try parseVideoArgs(args[2..], &config);
Expand Down
10 changes: 10 additions & 0 deletions src/generators/audio.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const cli = @import("../cli.zig");
const ffmpeg = @import("../ffmpeg.zig");

pub fn generate(allocator: std.mem.Allocator, config: cli.AudioConfig) !void {
try generateWithProgress(allocator, config, false);
}

pub fn generateWithProgress(allocator: std.mem.Allocator, config: cli.AudioConfig, show_progress: bool) !void {
print("Generating audio with parameters:\n", .{});
print(" Duration: {}s\n", .{config.duration});
print(" Sample rate: {}Hz\n", .{config.sample_rate});
Expand Down Expand Up @@ -78,6 +82,12 @@ pub fn generate(allocator: std.mem.Allocator, config: cli.AudioConfig) !void {
}

// Execute FFmpeg command
if (show_progress) {
print("🎵 Running FFmpeg encoder...\n", .{});
print("⏳ Please wait, encoding {d}s audio...\n", .{config.duration});
}

// Run FFmpeg
const result = std.process.Child.run(.{
.allocator = allocator,
.argv = cmd_args,
Expand Down
11 changes: 10 additions & 1 deletion src/generators/video.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ const cli = @import("../cli.zig");
const ffmpeg = @import("../ffmpeg.zig");

pub fn generate(allocator: std.mem.Allocator, config: cli.VideoConfig) !void {
try generateWithProgress(allocator, config, false);
}

pub fn generateWithProgress(allocator: std.mem.Allocator, config: cli.VideoConfig, show_progress: bool) !void {
print("Generating video with parameters:\n", .{});
print(" Resolution: {}x{}\n", .{ config.width, config.height });
print(" Duration: {}s\n", .{config.duration});
print(" FPS: {}\n", .{config.fps});
print(" Bitrate: {s}\n", .{config.bitrate});
print(" Format: {s}\n", .{config.format});
print(" Codec: {s}\n", .{config.codec});

print(" Output: {s}\n", .{config.output});

// Create input filter with countdown timer - black background with large white numbers
Expand Down Expand Up @@ -41,6 +44,12 @@ pub fn generate(allocator: std.mem.Allocator, config: cli.VideoConfig) !void {
};

// Execute FFmpeg command
if (show_progress) {
print("🎬 Running FFmpeg encoder...\n", .{});
print("⏳ Please wait, encoding {d}s video...\n", .{config.duration});
}

// Run FFmpeg
const result = std.process.Child.run(.{
.allocator = allocator,
.argv = &cmd_args,
Expand Down
Loading