Answers.Body: <p>The detailed answer by Gyan helped me to solve a practical problem which may be worth mentioning.</p>
  <p>Davinci Resolve cannot import .mpg files, but can import the same files when they are re-wrapped in .mov with the correct tag.</p>
  <p>The bash+ffmpeg command below can be used to:</p>
  <ul>
  <li>re-wrap all &quot;.mpg&quot; (or &quot;.MPG&quot;) files in the current directory to Quicktime .mov</li>
  <li>set the Codec ID to &quot;mp2v&quot; which works with both VLC and with Resolve</li>
  </ul>
  <pre class="lang-bash prettyprint-override"><code>for file in *.mpg *.MPG; do
      ffmpeg -i &quot;$file&quot; -c copy -vtag mp2v &quot;${file%%.[Mm][Pp][Gg]}&quot;.mov
  done
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-09T10:57:57.913Z
Answers.LastActivityDate: 2023-12-11T16:03:01.537Z
Answers.LastEditDate: 2023-12-11T16:03:01.537Z
Answers.UserDisplayName: mivk
Answers.Body: <p>Try &quot;MPG2&quot;. My stream was properly detected as MPEG-2 by MPC, MPC-HC and WMP.
  Source of info here: <a href="https://git.ffmpeg.org/gitweb/nut.git/blob_plain/HEAD:/docs/nut4cc.txt" rel="nofollow noreferrer">https://git.ffmpeg.org/gitweb/nut.git/blob_plain/HEAD:/docs/nut4cc.txt</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-02-21T22:05:41.177Z
Answers.LastActivityDate: 2022-08-03T05:44:06.200Z
Answers.LastEditDate: 2022-08-03T05:44:06.200Z
Answers.UserDisplayName: Marius95
Answers.Body: <p>Strictly speaking, <a href="https://msdn.microsoft.com/en-in/library/ms922669.aspx" rel="nofollow">fourcc</a> is the codec ID used by Microsoft. It has been adapted for use with many other formats, thus making it seem like a standardized ID format, but it's not.</p>
  
  <p>ffmpeg, in particular, seems to only consider XDCAM standard MPEG2 for inclusion in MOV.</p>
  
  <p>From the <a href="https://github.com/FFmpeg/FFmpeg/blob/6e249466cc6bd5b17d6e8cbd9a84a636cc92fd60/libavformat/movenc.c" rel="nofollow">source code</a>:</p>
  
  <pre><code>else if (track-&gt;enc-&gt;codec_id == AV_CODEC_ID_MPEG2VIDEO)
      tag = mov_get_mpeg2_xdcam_codec_tag(s, track);
  </code></pre>
  
  <p>where if the xdcam tag function doesn't find a matching XDCAM stream, it runs</p>
  
  <pre><code>if (!tag)
      tag = MKTAG('m', '2', 'v', '1'); //fallback tag
  </code></pre>
  
  <p>which ffmpeg, interestingly, <a href="https://github.com/FFmpeg/FFmpeg/blob/979572365f2133f969f3f49ec6a99cc8739d2eba/libavformat/isom.c" rel="nofollow">thinks</a> is tha tag that should be used for recording MPEG-2 in a MOV by a camera.</p>
  
  <pre><code>{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, /* Apple MPEG-2 Camcorder */ 
  </code></pre>
  
  <p>and <code>mp2v</code> is signalled as required for (an old version of) Final Cut Pro.</p>
  
  <pre><code>{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', '2', 'v') }, /* FCP5 */
  </code></pre>
  
  <p><code>mpgv</code> is not on that (ISO media) list that the MOV muxer can be forced to work with, but it is on the <a href="https://github.com/FFmpeg/FFmpeg/blob/11bc4fd653fab05a9e24f7aca22c913ffb238b5a/libavformat/riff.c" rel="nofollow">RIFF list</a> (for AVIs) where it's only declared for MPEG-2, not MPEG-1</p>
  
  <pre><code>{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') }
  </code></pre>
  
  <hr>
  
  <p>All the tag variants exist because each vendor or program decides to mark their streams a certain way and there's no single body policing their use. Stick with <code>mp2v</code> since that works for you.</p>
  
  <p><strong>Update</strong>: I just realized that any stream can be tagged with any tag if <code>-strict -1</code> or <code>-2</code> is applied. I was able to tag an AVC stream in a MOV with <code>mpgv</code> :) </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T14:30:09.317Z
Answers.Text: Thanks. Now, if I were to file an ffmpeg bug report claiming that `mp2v` should be the default output for mpeg2video+MOV instead of `m2v1`, would that be reasonable or does it seem like `m2v1` is still the more "correct" tag? I'm not particularly familiar with the Apple side of things. There's a discussion about this on the ffmpeg-user mailing list right now; I'll post a link as soon as it's archived.
Answers.UserDisplayName: Jason C
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T14:32:58.677Z
Answers.Text: Also, btw, is there general non-Microsoft terminology for FourCC's and their non-Microsoft spin-offs? "Tag"? "Object type"? "Codec ID"?
Answers.UserDisplayName: Jason C
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T14:51:02.447Z
Answers.Text: `Codec id` sounds the most vendor and format agnostic term to me. Considering that other people in that list can't play m2v1 files either, `mp2v` does sound a better fallback. Of course, also allowing custom tags via `-vtag` seems the most flexible way forward.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T17:52:34.943Z
Answers.Text: http://ffmpeg-users.933282.n4.nabble.com/MPEG-2-video-m2v1-vs-mp2v-tp4674329p4674338.html if it's interesting.
Answers.UserDisplayName: Jason C
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T10:24:04.633Z
Answers.LastActivityDate: 2016-02-03T16:11:27.930Z
Answers.LastEditDate: 2016-02-03T16:11:27.930Z
Answers.UserDisplayName: Gyan
Body: <p>In my attempts to encode a video to MPEG-2 in an MOV (which seems to be a valid combination, at least <a href="https://en.wikipedia.org/wiki/Comparison_of_video_container_formats" rel="nofollow">according to Wikipedia</a>), using ffmpeg (<code>-vcodec mpeg2video</code>) and other tools, I have become extremely confused about the FourCCs as well as seemingly related limitations on container formats. I have found:</p>
  
  <ul>
  <li><code>m2v1</code>: This is the default FourCC used by ffmpeg when encoding MPEG-2, but it is unplayable in all media players I have tried (VLC, Windows Media Player, mplayer, and QuickTime Player). It also does not seem to exist in any FourCC databases I have found. Forum posts are rare and are related to old Mac software and compatibility problems regarding this code.</li>
  <li><code>mp2v</code>: I can force this code with ffmpeg. It is then playable in all common media players. However, MPEG-2 videos encoded with other encoders (such as Handbrake or Prism), to AVIs, do not use this code, they use <code>mpgv</code>, which makes me suspicious.</li>
  <li><code>mpgv</code>: I can force this code with ffmpeg as well, but only when outputting to an AVI (and Handbrake uses it too but only outputs Matroska and MP4). Ffmpeg fails when I attempt to output MOV. Forum posts also indicate trouble with the <code>mpgv</code> + QuickTime container combination.</li>
  </ul>
  
  <p>I'm very confused. Why are there different FourCC's for this, what is the correct one to use, how is it related to the container and, at the end of the day, if I want an MPEG-2 in an MOV what do I do?</p>
  
  <p>I guess by "correct" in the title I mean compatible with the most common players; least likely to cause problems for normal people with stock software.</p>
  
  <p>As a sub-question, VLC describes <code>mpgv</code> and <code>mp2v</code> as "MPEG-1/2 Video". So, if I see a video with FourCC <code>mpgv</code>, is it MPEG-1, or is it MPEG-2? I suspect my lack of understanding of how all the MPEG versions are related to each other is coming into play here.</p>
  
Tags: <encoding><mpeg>
Title: What is the correct MPEG-2 FourCC?
UserDisplayName: Jason C
ThreadText: # What is the correct MPEG-2 FourCC?
  
  (Asked by: username_0 on 2016-01-28)
  
  In my attempts to encode a video to MPEG-2 in an MOV (which seems to be a valid combination, at least [according to Wikipedia](https://en.wikipedia.org/wiki/Comparison_of_video_container_formats)), using ffmpeg (`-vcodec mpeg2video`) and other tools, I have become extremely confused about the FourCCs as well as seemingly related limitations on container formats. I have found:
  
  * `m2v1`: This is the default FourCC used by ffmpeg when encoding MPEG-2, but it is unplayable in all media players I have tried (VLC, Windows Media Player, mplayer, and QuickTime Player). It also does not seem to exist in any FourCC databases I have found. Forum posts are rare and are related to old Mac software and compatibility problems regarding this code.
  * `mp2v`: I can force this code with ffmpeg. It is then playable in all common media players. However, MPEG-2 videos encoded with other encoders (such as Handbrake or Prism), to AVIs, do not use this code, they use `mpgv`, which makes me suspicious.
  * `mpgv`: I can force this code with ffmpeg as well, but only when outputting to an AVI (and Handbrake uses it too but only outputs Matroska and MP4). Ffmpeg fails when I attempt to output MOV. Forum posts also indicate trouble with the `mpgv` + QuickTime container combination.
  
  I'm very confused. Why are there different FourCC's for this, what is the correct one to use, how is it related to the container and, at the end of the day, if I want an MPEG-2 in an MOV what do I do?
  
  I guess by "correct" in the title I mean compatible with the most common players; least likely to cause problems for normal people with stock software.
  
  As a sub-question, VLC describes `mpgv` and `mp2v` as "MPEG-1/2 Video". So, if I see a video with FourCC `mpgv`, is it MPEG-1, or is it MPEG-2? I suspect my lack of understanding of how all the MPEG versions are related to each other is coming into play here.
  
  **Tags:** encoding, mpeg
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2016-01-28. Score: 4 | Accepted answer
  
  Strictly speaking, [fourcc](https://msdn.microsoft.com/en-in/library/ms922669.aspx) is the codec ID used by Microsoft. It has been adapted for use with many other formats, thus making it seem like a standardized ID format, but it's not.
  
  ffmpeg, in particular, seems to only consider XDCAM standard MPEG2 for inclusion in MOV.
  
  From the [source code](https://github.com/FFmpeg/FFmpeg/blob/6e249466cc6bd5b17d6e8cbd9a84a636cc92fd60/libavformat/movenc.c):
  
  ```
  else if (track->enc->codec_id == AV_CODEC_ID_MPEG2VIDEO)
      tag = mov_get_mpeg2_xdcam_codec_tag(s, track);
  
  ```
  
  where if the xdcam tag function doesn't find a matching XDCAM stream, it runs
  
  ```
  if (!tag)
      tag = MKTAG('m', '2', 'v', '1'); //fallback tag
  
  ```
  
  which ffmpeg, interestingly, [thinks](https://github.com/FFmpeg/FFmpeg/blob/979572365f2133f969f3f49ec6a99cc8739d2eba/libavformat/isom.c) is tha tag that should be used for recording MPEG-2 in a MOV by a camera.
  
  ```
  { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, /* Apple MPEG-2 Camcorder */ 
  
  ```
  
  and `mp2v` is signalled as required for (an old version of) Final Cut Pro.
  
  ```
  { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', '2', 'v') }, /* FCP5 */
  
  ```
  
  `mpgv` is not on that (ISO media) list that the MOV muxer can be forced to work with, but it is on the [RIFF list](https://github.com/FFmpeg/FFmpeg/blob/11bc4fd653fab05a9e24f7aca22c913ffb238b5a/libavformat/riff.c) (for AVIs) where it's only declared for MPEG-2, not MPEG-1
  
  ```
  { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') }
  
  ```
  
  ---
  
  All the tag variants exist because each vendor or program decides to mark their streams a certain way and there's no single body policing their use. Stick with `mp2v` since that works for you.
  
  **Update**: I just realized that any stream can be tagged with any tag if `-strict -1` or `-2` is applied. I was able to tag an AVC stream in a MOV with `mpgv` :)
  
  > **Comments:**
  > **username_0**: Thanks. Now, if I were to file an ffmpeg bug report claiming that `mp2v` should be the default output for mpeg2video+MOV instead of `m2v1`, would that be reasonable or does it seem like `m2v1` is still the more "correct" tag? I'm not particularly familiar with the Apple side of things. There's a discussion about this on the ffmpeg-user mailing list right now; I'll post a link as soon as it's archived.  
  > **username_0**: Also, btw, is there general non-Microsoft terminology for FourCC's and their non-Microsoft spin-offs? "Tag"? "Object type"? "Codec ID"?  
  > **username_3**: `Codec id` sounds the most vendor and format agnostic term to me. Considering that other people in that list can't play m2v1 files either, `mp2v` does sound a better fallback. Of course, also allowing custom tags via `-vtag` seems the most flexible way forward.  
  > **username_0**: http://ffmpeg-users.933282.n4.nabble.com/MPEG-2-video-m2v1-vs-mp2v-tp4674329p4674338.html if it's interesting.  
  
  ---
  
  ### Answer by username_1 on 2023-12-09. Score: 0
  
  The detailed answer by username_3 helped me to solve a practical problem which may be worth mentioning.
  
  Davinci Resolve cannot import .mpg files, but can import the same files when they are re-wrapped in .mov with the correct tag.
  
  The bash+ffmpeg command below can be used to:
  
  * re-wrap all ".mpg" (or ".MPG") files in the current directory to Quicktime .mov
  * set the Codec ID to "mp2v" which works with both VLC and with Resolve
  
  ```bash
  for file in *.mpg *.MPG; do
      ffmpeg -i "$file" -c copy -vtag mp2v "${file%%.[Mm][Pp][Gg]}".mov
  done
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2016-02-21. Score: 0
  
  Try "MPG2". My stream was properly detected as MPEG-2 by MPC, MPC-HC and WMP.
  Source of info here: <https://git.ffmpeg.org/gitweb/nut.git/blob_plain/HEAD:/docs/nut4cc.txt>
  
  
  ---
  
  