A production-grade C# console application that processes image and video files with frame extraction capabilities.
- File Validation: Validates media files for correct format and integrity
- Temporary Folder Management: Creates isolated temporary folders for safe processing
- Image Processing: Copies images to processing folder
- Video Processing: Extracts all frames from video files using FFMpeg
- Production-Grade Code: Clean architecture, proper error handling, and resource management
.jpg,.jpeg,.png,.gif,.bmp,.webp,.tiff,.ico
.mp4,.avi,.mkv,.mov,.flv,.wmv,.webm,.m4v,.mpg,.mpeg,.3gp
- .NET 8.0 or later
- FFmpeg (required for video processing)
- Windows: Download from https://ffmpeg.org/download.html
- Ensure FFmpeg is in your system PATH or in the application directory
dotnet builddotnet run -- "path/to/media/file"MediaProcessor.exe "C:\path\to\image.jpg"
MediaProcessor.exe "C:\path\to\video.mp4"dotnet run -- "C:\path\to\media\file.mp4"MediaProcessor/
├── Models/
│ ├── MediaType.cs # Enum for media types
│ ├── MediaFile.cs # Media file model
│ └── OperationResult.cs # Result pattern for operations
├── Services/
│ ├── FileValidationService.cs # File validation and format checking
│ ├── TemporaryFolderService.cs # Temp folder creation and cleanup
│ ├── ImageProcessingService.cs # Image operations
│ ├── VideoProcessingService.cs # Video frame extraction
│ └── MediaProcessorService.cs # Main orchestrator
├── Program.cs # Entry point
└── MediaProcessor.csproj # Project file
- Validation Phase: Validates file exists and is in a supported format
- Folder Creation: Creates a unique temporary folder for the session
- Processing Phase:
- For Images: Copies the image file to the temp folder
- For Videos: Creates a
video-framessubfolder and extracts all frames
- Cleanup: Temp folder is retained for user inspection (can be manually deleted)
- Each service handles a specific responsibility
- Loose coupling through dependency injection
- Easy to extend or modify individual components
- All operations return
OperationResultfor consistent error reporting - Proper exception handling at all levels
- Informative error messages for debugging
- Implements
IDisposablepattern for proper cleanup - Automatic temporary folder management
- Efficient file handling
=== Media Processor ===
Processing file: C:\video.mp4
✓ File validation successful - Type: Video
✓ Temporary folder created: C:\Users\...\AppData\Local\Temp\MediaProcessor\guid\
✓ Video frames folder created: C:\Users\...\AppData\Local\Temp\MediaProcessor\guid\video-frames
✓ Successfully extracted 150 frames from video
✓ Processing completed successfully!
✓ Output folder: C:\Users\...\AppData\Local\Temp\MediaProcessor\guid\
Note: Temporary folder will be retained for your use.
Temp folder location: C:\Users\...\AppData\Local\Temp\MediaProcessor\guid\
- FFMpegCore (v5.1.0): .NET wrapper for FFmpeg for video frame extraction
As mentioned, the next phase will expand this foundation to include:
- Advanced image processing
- Video metadata extraction
- Frame filtering and transformation
- Batch processing capabilities
- Output customization
[Your License Here]
- The temporary folder is intentionally retained for user inspection
- All file paths support both absolute and relative paths
- The application uses FFmpeg for video processing, which must be installed separately