What is MIME type "video/x-mpg"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
video/x-mpg is a MIME type that signals files encoded in the MPEG-2 video format.It lets media players and browsers know how to handle the content.
Files like MPG and MPEG are commonly marked with this type.
- Video Playback: Enables smooth streaming and local viewing.
- Broadcasting: Used in television and DVD production systems.
- Editing: Supported by many editing and transcoding tools.
Learn more at IANA Video Media Types.
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: video/x-mpg
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="video/x-mpg">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'video/x-mpg');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
Is video/x-mpg a standard MIME type?
No, the x- prefix indicates that it is a non-standard or private MIME type. The official standard registered with IANA is video/mpeg. However, video/x-mpg is frequently used for backward compatibility with older web servers and media players.
How do I configure Apache to serve video/x-mpg files?
You can ensure your Apache server sends the correct header by modifying your .htaccess or httpd.conf file. Add the line AddType video/x-mpg .mpg .mpeg to map the extensions to this specific MIME type.
Can I use video/x-mpg files in HTML5 video tags?
Generally, no. Most modern browsers (like Chrome and Safari) do not natively support the MPEG-1 or MPEG-2 codecs usually associated with video/x-mpg in the <video> element. For web usage, it is highly recommended to transcode these files to H.264 (video/mp4) or WebM.
Why is my .mpg file downloading instead of playing in the browser?
This often happens if the browser does not support the video codec or if the server sends the wrong Content-Type header, such as application/octet-stream. Ensure your server is configured to send video/x-mpg or video/mpeg, though codec support remains the biggest barrier for inline playback.
What is the difference between video/x-mpg and video/mpeg?
video/mpeg is the standardized type, while video/x-mpg is an older convention. Functionally, most operating systems and media players treat them identically, associating both with extensions like .mpg and .mpeg.
How do I add video/x-mpg support to Nginx?
To support this type in Nginx, locate your mime.types file or the types block in your configuration. Add the entry video/x-mpg mpg mpeg; to ensure the server correctly identifies these files.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.