A NestJS application that generates MovieLabs-compliant XML files (MEC and MMC) for Amazon Prime Video content delivery. Supports both CSV file uploads and modern JSON API endpoints.
- MEC (Media Entertainment Core): Generates metadata XML for your content (title, cast, genres, ratings, release dates, etc.)
- MMC (Media Manifest Core): Generates technical specifications XML for your media files (video/audio tracks, subtitles, presentations)
- Image-Only: Generates XML for promotional images and artwork
- CSV Upload (Legacy) - Upload CSV files via web interface or API
- JSON API (Modern) - Send JSON payloads programmatically with auto-generated IDs
npm install# Development mode with hot-reload
npm run start:dev
# Production mode
npm run start:prodThe service will start on http://localhost:3000
Once running, access the Swagger UI for interactive testing and complete documentation:
http://localhost:3000/api
Generate XML programmatically with JSON payloads. IDs are auto-generated from your content URLs.
curl -X POST http://localhost:3000/generate/mmc \
-H "Content-Type: application/json" \
-d '{
"audio": [{
"type": "stereo",
"language": "en-US",
"location": "https://cdn.example.com/my-movie/audio.aac"
}],
"video": [{
"type": "primary",
"language": "en-US",
"location": "https://cdn.example.com/my-movie/video.mp4",
"picture": {
"heightPixels": "1080",
"widthPixels": "1920"
}
}],
"presentation": [{}],
"experience": [{
"type": "Movie",
"subType": "Feature"
}],
"alidExperience": [{}]
}'curl -X POST http://localhost:3000/generate/mec \
-H "Content-Type: application/json" \
-d '{
"localizedInfo": [{
"language": "en-US",
"titleDisplay": "My Movie",
"summary400": "An amazing film about..."
}],
"genre": [{"primary": "Action"}],
"releaseDate": "2024-01-15",
"releaseHistory": [{
"type": "Original",
"country": "US",
"date": "2024-01-15"
}],
"workType": "movie",
"cast": [{
"jobFunction": "Actor",
"billingBlockOrder": "1",
"displayName": {"en-US": "Actor Name"}
}]
}'Note: Fields like contentId, releaseYear, identifier, originalLanguage, organization, and companyDisplayCredit are auto-generated if not provided.
See Full Examples: Check the samples/json/ directory for complete JSON payloads including multi-language content, subtitles, and more.
Upload CSV files to generate XML:
curl -X POST http://localhost:3000/upload \
-F "file=@samples/csv/minimal-MMC.csv" \
-F "variant=MMC"Supported Variants: MEC, MMC, Image-Only
Sample CSV Files: See samples/csv/ directory for template CSV files.
The JSON API automatically generates MovieLabs-compliant IDs:
MEC (Metadata) Auto-Generation:
- ContentID: Auto-generated from
titleDisplay(e.g., "The Matrix" →md:cid:org:wiflix:the-matrix) - ReleaseYear: Auto-extracted from
releaseDate(e.g., "2024-03-15" → "2024") - Identifier: Auto-generated from ContentID with namespace "ORG"
- OriginalLanguage: Auto-defaults to first
localizedInfolanguage (e.g., "en-US" → "en") - Organization: Auto-generated from
DEFAULT_ORGANIZATIONconfig (e.g., "wiflix" →md:orgid:wiflix) - CompanyDisplayCredit: Auto-capitalized organization name (e.g., "wiflix" → "Wiflix")
- ParentContentID: Auto-generated from
parentTitleDisplayfor episodic content
MMC (Manifest) Auto-Generation:
- Track IDs: Video, audio, subtitle, and image track identifiers
- Presentation IDs: Derived from video location URLs
- Experience IDs: Auto-linked to presentations
- ALIDs: Asset list identifiers
- Aspect Ratio: Calculated from video dimensions
- Title Sort: Removes articles (The, A, An) from titles
Input URL: https://cdn.example.com/chioma-my-love/video.mp4
Generated IDs:
- Video Track: md:vidtrackid:org:wiflix:chioma-my-love:video-en-us
- Audio Track: md:audtrackid:org:wiflix:chioma-my-love:audio-en-us
- Presentation: md:presentationid:org:wiflix:chioma-my-love:presentation
- Experience: md:experienceid:org:wiflix:chioma-my-love:experience
For content with multiple audio or subtitle languages, track IDs are automatically made unique using language codes:
{
"audio": [
{ "language": "en-US", ... }, // → audio-en-us
{ "language": "es-ES", ... }, // → audio-es-es
{ "language": "fr-FR", ... } // → audio-fr-fr
]
}| Endpoint | Method | Description |
|---|---|---|
/generate/mmc |
POST | Generate MMC XML from JSON |
/generate/mec |
POST | Generate MEC XML from JSON |
/upload |
POST | Upload CSV file (returns ZIP) |
/api |
GET | Swagger UI documentation |
- Swagger UI:
http://localhost:3000/api- Interactive API documentation with examples - JSON Examples:
samples/json/README.md- Complete guide with example payloads - CSV Samples:
samples/csv/README.md- CSV template files and usage guide
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov.
├── samples/json/ # JSON API example payloads
│ ├── mmc-minimal.json
│ ├── mmc-multiple-tracks.json
│ ├── mec-minimal.json
│ ├── mec-complete.json
│ └── README.md
├── samples/csv/ # CSV template files
│ ├── minimal-MMC.csv
│ ├── optimized-MMC.csv
│ ├── minimal-MEC.csv
│ └── README.md
├── src/
│ ├── controllers/
│ │ ├── file.controller.ts # CSV upload endpoint
│ │ └── generate.controller.ts # JSON API endpoints
│ ├── services/
│ │ ├── file.service.ts # CSV processing
│ │ └── generate.service.ts # JSON XML generation
│ ├── dto/generate/
│ │ ├── mmc.dto.ts # MMC validation DTOs
│ │ └── mec.dto.ts # MEC validation DTOs
│ ├── decorators/
│ │ └── swagger.decorators.ts # API documentation decorators
│ ├── infrastructure/
│ │ ├── file.processor.ts
│ │ ├── file-type-detector.ts
│ │ └── data.processor.ts
│ └── main.ts
└── test/
└── e2e/
├── upload.e2e-spec.ts
└── generate.e2e-spec.ts- Node.js v18.0.0 or higher
- npm v7.0.0 or higher
- NestJS: Web framework
- mec-mmc-maker: Modern XML builder library with builder pattern
- mdmec-xml-maker: Legacy CSV-based XML generation library
- class-validator: DTO validation
- @nestjs/swagger: API documentation
The service runs on port 3000 by default. Configure via:
PORT=3000 # Default portThis service generates XML files compliant with:
- MovieLabs MEC (Media Entertainment Core) v2.9
- MovieLabs MMC (Media Manifest Core) v1.9
- MovieLabs Specifications
- Amazon Prime Video - MEC Title Metadata Guide
- Amazon Prime Video - MMC Asset Manifest Guide
- Amazon Prime Video - Metadata Overview
Use samples/json/mmc-minimal.json and samples/json/mec-minimal.json
Use samples/json/mmc-multiple-tracks.json and samples/json/mec-complete.json
Use episodic example in samples/json/mec-complete.json with category field
See samples/json/mec-complete.json with rating array
Ensure content IDs follow: md:cid:org:{organization}:{content-slug}
Check Swagger UI at /api for complete field requirements
For multiple tracks of the same type, ensure different language codes or provide explicit trackId values