A command-line tool to extract metadata from MP4 video files.
- Extract basic, extended, or full metadata from MP4 files.
- Supports file information, movie information (tags, title, duration), and track information (bitrate, codecs, resolution).
- Export metadata as JSON or XML files.
- Upload metadata directly to S3-compatible storage services including AWS S3 and MinIO.
- Clear and formatted output to the console.
-
Prerequisites:
-
Get the package:
go install github.com/joeldelpilar/vme@latest
vme [flags] <mp4-file>-b: Basic metadata (file information only).-e: Extended metadata (file and movie information).-f: Full metadata (file, movie, and track information).-o: Output format (json/xml) - exports metadata to a file instead of console output.
-s3-upload: Enable uploading metadata files to S3 storage.-s3-bucket: S3 bucket name (required when using -s3-upload).-s3-region: AWS region (default: "us-east-1").-s3-endpoint: Custom endpoint URL for S3-compatible services like MinIO.-s3-ssl: Use SSL for S3 connection (default: true, set to false for local development).
When using S3 integration, the following environment variables are required:
VME_S3_ACCESS_KEY: S3 access key for authentication.VME_S3_SECRET_KEY: S3 secret key for authentication.
To enable the installation of the vme command, you can use the following commands:
make build
make install
make clean-
Extract basic metadata from local file:
vme -b video.mp4
-
Extract full metadata from S3/MinIO and save as JSON:
vme -f -o json s3://my-bucket/video.mp4 \ -s3-endpoint https://minio.example.com \ -s3-bucket output-bucket \ -s3-upload -
Using MinIO with custom endpoint and SSL disabled:
# Set required environment variables export VME_S3_ACCESS_KEY="your_access_key" export VME_S3_SECRET_KEY="your_secret_key" # Run command vme -f \ -s3-endpoint https://your-minio-server.com \ -s3-bucket your-bucket \ -s3-ssl=false \ -o json \ -s3-upload \ s3://input-bucket/path/to/video.mp4
This will:
- Download the video from S3/MinIO
- Extract full metadata
- Save it as JSON
- Upload the metadata file back to the specified bucket
When using the -o flag and not using the -s3-upload flag, the metadata will be exported to a file named <input-filename>-metadata.<format> in the current directory. For example, if your input file is video.mp4 and you use -o json, the output will be saved as video-metadata.json.
If you want to test the S3 functionality locally without using actual cloud services, you can use MinIO running in Docker.
-
Start MinIO with Docker:
docker run -p 9000:9000 -p 9001:9001 --name minio \ -e "MINIO_ROOT_USER=minioadmin" \ -e "MINIO_ROOT_PASSWORD=minioadmin" \ bitnami/minio:latest
-
Access the MinIO web interface at http://localhost:9001 and log in with:
- Username:
minioadmin - Password:
minioadmin
- Username:
-
Create a new bucket (e.g., "test-bucket") through the web interface.
Once MinIO is running, you can use vme to upload metadata to it:
# Set environment variables for authentication
export VME_S3_ACCESS_KEY=minioadmin
export VME_S3_SECRET_KEY=minioadmin
# Extract and upload metadata to local MinIO
vme -f -o json -s3-upload -s3-bucket test-bucket -s3-endpoint http://localhost:9000 -s3-ssl=false video.mp4This setup is perfect for development and testing of the S3 integration functionality without requiring actual cloud resources.
The tool uses ffprobe (from the FFmpeg suite) to analyze the MP4 file and extract metadata. The extracted data is then formatted and displayed in the console or exported to a file in the specified format.
When using S3 integration, the tool creates a client to the specified S3 service (AWS S3 or a compatible alternative like MinIO) and uploads the exported metadata file.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
- Joel del Pilar - GitHub
- Uses the FFmpeg project for media analysis.
- Inspired by the need for a simple and effective MP4 metadata extraction tool.
