Difference between revisions of "MPEG-4"

From VideoLAN Wiki
Jump to navigation Jump to search
(→‎Further reading: New section with link to 57-page MPEG-4 PDF (1999 publication) regarding MPEG-4 ISO/IEC standard, move other link to this section)
 
(27 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{wikipedia|MPEG-4}}
 
{{wikipedia|MPEG-4}}
{{mmwiki|ISO MPEG-4|ISO_MPEG-4}}
+
{{mmwiki|ISO MPEG-4}}
  
'''MPEG-4''' is a form of '''[[MPEG]]''' encoding. It is a flexible audio and video compression format. The format describes audio and video compression, with a container format for streaming across networks and saving to disk. It also contains optional extra features, including [[DRM]] and [[subtitles]]. These extra features are only included in software if needed.  MPEG-4 can provide better quality than MPEG-2 at low bitrates.
+
'''MPEG-4''' is a form of '''[[MPEG]]''' encoding. It is a flexible audio and video compression format. The format describes audio and video [[compression]], with a container format for streaming across networks and saving to disk. It also contains optional extra features, including [[DRM]] and [[subtitles]]. These extra features are only included in software if needed.  MPEG-4 can provide better quality than MPEG-2 at low [[bitrate]]s.
  
 
Here is an example of how to transcode an AVI into an MPEG-4 video from the [[command prompt]]
 
Here is an example of how to transcode an AVI into an MPEG-4 video from the [[command prompt]]
  {{%}} vlc ''file.avi'' --[[sout]]='#[[transcode]]{vcodec=mp4v,acodec=mpga}:std{access=file,mux=mp4,dst=''file.m4v''}'
+
  {{%}} vlc ''file.avi'' --[[sout]]='#[[transcode]]{vcodec=mp4v,acodec=mp4a}:std{access=file,mux=mp4,dst=''file.m4v''}'
 +
 
 +
MPEG-4 audio is an advanced, complicated audio format. It includes [[AAC]] for high bitrates, multilingual tracks, text-to-speech modes for very low bitrates, the ability to synthesize instrumental sounds (similar to [[MIDI]]), and more.
  
 
== Codecs ==
 
== Codecs ==
{{codec audio|id=mp4a|altid=m4a|mod=ffmpeg}}
+
{{codec audio|id=mp4a|altid=m4a|mod=avcodec|for=MPEG-4}}
{{codec video|id=mp4v|altid=m4v|mod=ffmpeg}}
+
{{codec video|id=mp4v|altid=m4v|mod=avcodec|for=MPEG-4}}
  
 
MPEG-4 specifies a range of codecs
 
MPEG-4 specifies a range of codecs
  
 
The [[fourcc]]s of MPEG-4 codecs are:
 
The [[fourcc]]s of MPEG-4 codecs are:
 +
* DivX Codecs
 +
** DIV1, div1, DIVX, divx, DX50, dx50, XVID, XviD, xvid
 +
* [[FFMPEG]] MPEG-4
 +
** FMP4, fmp4
 
* 3IV2, 3iv2
 
* 3IV2, 3iv2
 
* BLZ0
 
* BLZ0
* DIV1, div1, DIVX, divx, DX50, dx50
 
 
* DXGM
 
* DXGM
* FMP4, fmp4
 
 
* HDX4, hdx4
 
* HDX4, hdx4
 
* M4S2, m4s2
 
* M4S2, m4s2
Line 28: Line 32:
 
* UMP4
 
* UMP4
 
* WV1F
 
* WV1F
* XVID
 
* XviD, xvid
 
 
* XVIX
 
* XVIX
  
== File extension ==
+
== Container ==
MP4 ('''.mp4''') is the global file extension for the official container format defined in the [[MPEG]]-4 standard (ISO 14496-14).
+
MP4 ('''.mp4''') is the global file extension for the official container format defined in the MPEG-4 standard (ISO 14496-14).
  
 
* '''.mp4''': the only official extension; used for both audio and video files (and advanced content)
 
* '''.mp4''': the only official extension; used for both audio and video files (and advanced content)
* '''.m4a''': introduced by Apple for aac/alac ''audio-only'' files.  
+
* '''.3gp''': this extension is used for the 3gp format, derived from the ISO standard
 +
* '''.m4a''': introduced by Apple for aac/alac ''audio-only'' files.
  
NOTE: .m4a files can safely be renamed to .mp4 -- but the distinction between audio (m4a) and video (mp4) may be useful if you are going to share files, or if you tend to forget what files you have.
+
NOTE: .m4a files can safely be renamed to .mp4—but the distinction between audio (m4a) and video (mp4) may be useful if you are going to share files, or if you tend to forget what files you have.
  
 
For complete details on MP4, see the following link:
 
For complete details on MP4, see the following link:
Line 44: Line 47:
 
*http://forum.doom9.org/showthread.php?s=&threadid=62723
 
*http://forum.doom9.org/showthread.php?s=&threadid=62723
  
== .mp4 audio ==
+
=== <span id="Audio"></span> .mp4 audio ===
{{codec audio|id=mp4a|for=[[mpeg]], '''mp4''', [[asf]] and [[matroska]]}}
 
 
'''.m4a''' is the [[file extension]] attached to names of files containing [[MPEG-4]] Audio. Generally, MPEG-4 files are have the '''.mp4''' file extension.
 
'''.m4a''' is the [[file extension]] attached to names of files containing [[MPEG-4]] Audio. Generally, MPEG-4 files are have the '''.mp4''' file extension.
  
 
The .m4a file extension has been popularized by Apple, which started using the .m4a file extension in their [[iTunes]] software and [[iPod]] music players to distinguish between MPEG-4 Video and Audio files. Currently, most software that supports MPEG-4 Audio also supports the .m4a extension. The most common type of .m4a files available are those using the AAC ([[Advanced Audio Coding]]) audio format, but other formats such as [[Apple Lossless]] and even [[mp3]] files may be put inside a .m4a container file. You can normally safely rename the file extension of an .mp4 file containing only audio to .m4a or vice versa to get the file to properly play in your favorite audio player.
 
The .m4a file extension has been popularized by Apple, which started using the .m4a file extension in their [[iTunes]] software and [[iPod]] music players to distinguish between MPEG-4 Video and Audio files. Currently, most software that supports MPEG-4 Audio also supports the .m4a extension. The most common type of .m4a files available are those using the AAC ([[Advanced Audio Coding]]) audio format, but other formats such as [[Apple Lossless]] and even [[mp3]] files may be put inside a .m4a container file. You can normally safely rename the file extension of an .mp4 file containing only audio to .m4a or vice versa to get the file to properly play in your favorite audio player.
  
===Protected MPEG-4 Audio===
+
====Protected MPEG-4 Audio====
When these files have [[digital rights management]] (DRM) restrictions applied to them, their extension are often changed to '''.m4p''', the ''p'' standing for ''protected''. Music files purchased from the [[iTunes Music Store]], for example, have this extension.
+
When these files have [[digital restrictions management]] (DRM) applied to them, their extension are often changed to '''.m4p''', the ''p'' standing for ''protected''. Music files purchased from the iTunes Music Store, for example, have this extension.
  
===Audiobooks===
+
====Audiobooks====
When they contain audiobook data, MPEG-4 files have a .m4b extension.
+
When they contain audiobook data, MPEG-4 files have a '''.m4b''' extension.
  
 
== Container ==
 
== Container ==
Line 68: Line 70:
 
* [[H263]]
 
* [[H263]]
 
* [[h264]]
 
* [[h264]]
* [[samr]]
 
* [[sawb]]
 
  
 
=== Accepted audio codecs ===
 
=== Accepted audio codecs ===
* [[mp4a]]
+
* [[mp4a]] (is [[AAC|aac]])
 
* [[mpga]]
 
* [[mpga]]
 +
* [[samr]]
 +
* [[sawb]]
  
 
=== Accepted subtitle codec ===
 
=== Accepted subtitle codec ===
 
* [[subt]]
 
* [[subt]]
 +
 +
== Decoding libraries ==
 +
 +
In addition to [[FFmpeg]], there is [[MPEG4IP]] that can decode MPEG-4 streams.
  
 
== Source code ==
 
== Source code ==
{{file|modules/mux/mp4.c|output muxer}}
+
{{file|modules/mux/mp4/mp4.c|output muxer}}
{{file|modules/demux/mp4|input demuxer}}
+
{{file|modules/demux/mp4/mp4.c|input demuxer}}
 +
 
 +
== Further reading ==
 +
* [https://sound.media.mit.edu/resources/mpeg4/audio/faq/mpeg4.html MPEG-4 Audio FAQ (2000 publication)]
 +
* [https://sound.media.mit.edu/resources/mpeg4/audio/general/w3156.pdf MPEG-4 ISO/IEC standard (1999 publication)]

Latest revision as of 04:07, 16 May 2019

MPEG-4 is a form of MPEG encoding. It is a flexible audio and video compression format. The format describes audio and video compression, with a container format for streaming across networks and saving to disk. It also contains optional extra features, including DRM and subtitles. These extra features are only included in software if needed. MPEG-4 can provide better quality than MPEG-2 at low bitrates.

Here is an example of how to transcode an AVI into an MPEG-4 video from the command prompt

% vlc file.avi --sout='#transcode{vcodec=mp4v,acodec=mp4a}:std{access=file,mux=mp4,dst=file.m4v}'

MPEG-4 audio is an advanced, complicated audio format. It includes AAC for high bitrates, multilingual tracks, text-to-speech modes for very low bitrates, the ability to synthesize instrumental sounds (similar to MIDI), and more.

Codecs

mp4a
This is an audio codec. The name to use at the command line is mp4a, but you can also use m4a.
This codec can be used inside the MPEG-4 containers.
This codec is from the avcodec module.
mp4v
This is a video codec. The name to use at the command line is mp4v, but you can also use m4v.
This codec can be used inside the MPEG-4 containers.
This codec is from the avcodec module.

MPEG-4 specifies a range of codecs

The fourccs of MPEG-4 codecs are:

  • DivX Codecs
    • DIV1, div1, DIVX, divx, DX50, dx50, XVID, XviD, xvid
  • FFMPEG MPEG-4
    • FMP4, fmp4
  • 3IV2, 3iv2
  • BLZ0
  • DXGM
  • HDX4, hdx4
  • M4S2, m4s2
  • MP4S, mp4s
  • MP4V, mp4v
  • RMP4
  • SEDG
  • SMP4
  • UMP4
  • WV1F
  • XVIX

Container

MP4 (.mp4) is the global file extension for the official container format defined in the MPEG-4 standard (ISO 14496-14).

  • .mp4: the only official extension; used for both audio and video files (and advanced content)
  • .3gp: this extension is used for the 3gp format, derived from the ISO standard
  • .m4a: introduced by Apple for aac/alac audio-only files.

NOTE: .m4a files can safely be renamed to .mp4—but the distinction between audio (m4a) and video (mp4) may be useful if you are going to share files, or if you tend to forget what files you have.

For complete details on MP4, see the following link:

.mp4 audio

.m4a is the file extension attached to names of files containing MPEG-4 Audio. Generally, MPEG-4 files are have the .mp4 file extension.

The .m4a file extension has been popularized by Apple, which started using the .m4a file extension in their iTunes software and iPod music players to distinguish between MPEG-4 Video and Audio files. Currently, most software that supports MPEG-4 Audio also supports the .m4a extension. The most common type of .m4a files available are those using the AAC (Advanced Audio Coding) audio format, but other formats such as Apple Lossless and even mp3 files may be put inside a .m4a container file. You can normally safely rename the file extension of an .mp4 file containing only audio to .m4a or vice versa to get the file to properly play in your favorite audio player.

Protected MPEG-4 Audio

When these files have digital restrictions management (DRM) applied to them, their extension are often changed to .m4p, the p standing for protected. Music files purchased from the iTunes Music Store, for example, have this extension.

Audiobooks

When they contain audiobook data, MPEG-4 files have a .m4b extension.

Container

mp4
VLC can encode and decode this container.
The module name to use at the command line is mp4, but you can also use mov, or 3gp.

Accepted video codecs

Accepted audio codecs

Accepted subtitle codec

Decoding libraries

In addition to FFmpeg, there is MPEG4IP that can decode MPEG-4 streams.

Source code


Further reading