MythIQ

Command Palette

Search for a command to run...

File Transcoding

Learn how MythIQ handles media file transcoding to ensure optimal compatibility and performance.

Overview

File transcoding is the process of converting media files from one format to another to ensure compatibility, optimize file size, and improve playback performance. MythIQ automatically handles transcoding for various media types, particularly for videos and images generated by AI models or uploaded by users.

The transcoding system is designed to:

  • Convert files to widely supported formats for maximum compatibility
  • Optimize file sizes while maintaining quality
  • Generate multiple variants for different use cases (e.g., thumbnails, previews)
  • Ensure consistent behavior across different providers and models

Automatic Processing

MythIQ's transcoding system works automatically in the background, optimizing your media files without requiring any manual intervention or configuration.

Transcoding Process

When a file is generated by an AI model or uploaded by a user, it goes through the following transcoding process:

1. Initial Assessment

The system analyzes the file to determine its format, quality, and characteristics. This assessment helps decide what transcoding operations are needed.

2. Format Conversion

If the file is in a format that's not widely supported or optimal for web delivery, it's converted to a more suitable format:

Images

Converted to JPEG or WebP for general use, with PNG preserved for images requiring transparency

Videos

Converted to MP4 with H.264 encoding for broad compatibility, with additional WebM format for modern browsers

3. Variant Generation

The system creates multiple variants of the file for different use cases:

Thumbnails

Small, low-resolution versions for listings and previews

Responsive Sizes

Multiple resolutions for responsive web and mobile applications

Preview Frames

For videos, static image frames are extracted to serve as previews

Image Transcoding

MythIQ applies several image transcoding techniques to optimize generated and uploaded images:

Format Conversion

Images are converted to optimal formats based on their content and intended use:

Source FormatTarget FormatUse Case
AnyJPEGPhotos and images without transparency
AnyWebPModern browsers, better compression than JPEG
Any with transparencyPNGImages requiring transparency

Video Transcoding

Video transcoding is particularly important for ensuring smooth playback across different devices and network conditions:

Format and Codec Conversion

Videos are transcoded to widely supported formats and codecs:

Target FormatCodecUse Case
MP4H.264Universal compatibility
WebMVP9Modern browsers, better compression

Adaptive Streaming

For longer videos, MythIQ generates adaptive streaming formats that allow players to dynamically adjust quality based on network conditions:

  • HLS (HTTP Live Streaming) for iOS and Safari
  • DASH (Dynamic Adaptive Streaming over HTTP) for other browsers

API Integration

Transcoding happens automatically in the background, and you don't need to explicitly request it. However, you can access different variants of a file through the API:

Accessing File Variants

When you retrieve a file through the API, the response includes URLs for different variants:

json
{
  "id": "abc123",
  "url": "https://cdn.example.com/user/abc123/main.jpg", // Original or high-quality version
  "thumbnailUrl": "https://cdn.example.com/user/abc123/thumbnail.jpg",
  "variants": [
    {
      "size": "small",
      "width": 256,
      "height": 256,
      "url": "https://cdn.example.com/user/abc123/small.jpg"
    },
    {
      "size": "medium",
      "width": 512,
      "height": 512,
      "url": "https://cdn.example.com/user/abc123/medium.jpg"
    }
  ]
}

Best Practices

Use Appropriate Variants

Choose the appropriate file variant for your use case to optimize performance:

  • Use thumbnails for listings and previews
  • Use responsive variants based on display size
  • Only load the highest quality version when necessary

Consider Transcoding Time

Be aware that transcoding, especially for videos, can take some time. The API will return the file immediately, but some variants might not be available right away. Check the status field to see if transcoding is complete.