<p>PAL and NTSC have different color primaries, so </p>

<p>NTSC = SMPTE 170M = BT 601 525</p>

<p>PAL = BT 470 BG = BT 601 625</p>

<p>See the rows for value 5 &amp; 6 on the table on page 387 of the active H.264 <a href="http://www.itu.int/rec/T-REC-H.264-201402-I/en" rel="noreferrer">standard</a>.</p>

<hr>

<p>So the right args for ffmpeg are:</p>

<p>NTSC:</p>

<pre><code># NTSC
ffmpeg -i input  \
 -colorspace smpte170m -color_primaries smpte170m -color_trc smpte170m

mediainfo:
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601
</code></pre>

<p>PAL:</p>

<p><code>-color_trc</code> doesn't accept <code>bt470bg</code>, but <code>ffmpeg -h full</code> shows that <code>gamma28</code> means "BT.470 BG" for that option.</p>

<pre><code># PAL
ffmpeg -i input  \
 -colorspace bt470bg -color_primaries bt470bg -color_trc gamma28

mediainfo:
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.470 System B, BT.470 System G
Matrix coefficients                      : BT.601
</code></pre>

<p><code>-colorspace</code> is the most important option; the others don't make a visible difference for software players like <code>mpv</code> on Linux.</p>

CC BY-SA 3.0
2015-11-08T05:51:10.740Z
Ah of course.  I was even looking at the bt601 wikipedia page, and didn't clue in from the table having two rows.  Derp.
Peter Cordes
CC BY-SA 3.0
2018-02-17T02:58:57.967Z
For those looking to do this same setting with HandBrake, under the Video tab, inside the Extra Options edit box, enter this string: "colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m"
pcunite
CC BY-SA 4.0
2015-11-08T05:36:43.623Z
2019-05-10T10:29:09.653Z
2019-05-10T10:29:09.653Z
Gyan
<p>I want to tag video as explicitly bt.601, rather than "unspecified".  I know players typically choose bt.601 as the default for videos less than 1280 pixels wide, but I want to make it explicit that bt.601 is the correct colour matrix for a video.</p>

<p>The sticking point is that there is no <code>bt601</code> option for ffmpeg or libx264, only bt709 and some others.</p>

<p>I have some videos that were downscaled from HD, and are still in bt.709, but aren't tagged properly.  So when I watch a video, I sometimes have to <a href="https://github.com/mpv-player/mpv/issues/1804#issuecomment-92411790" rel="noreferrer">manually toggle my player to bt.709</a>.  Tagging explicitly as bt.601 will communicate to future viewers (e.g. myself) that it's definitely bt.601, and not a mis-tagged bt.709 video, when I look at it with <code>mediainfo</code>.</p>

<p>Another use-case for this would be if you upscaled a bt.601 video to 1280 or higher without doing a colormatrix conversion (using <code>-vf colormatrix</code>), players would incorrectly assume bt.709 if you left the color information unspecified.</p>

<p>FFMpeg's <code>colormatrix</code> video filter does support <code>bt601</code> as an input or output color matrix, but doesn't also set tags.  (Since it doesn't have the side-effect of setting ffmpeg's color options, it refuses to even operate with src and dest the same, like <code>-vf colormatrix=bt601:bt601</code>.)</p>

<hr>

<pre><code>ffmpg in  -color_primaries bt709 -color_trc bt709 -colorspace bt709  out
</code></pre>

<p>will tag the output video as using bt.709 for yuv&lt;->rgb.  The tags end up inside the video bitstream itself, not just in the container (since this is seems to be a codec-specific thing, not a container thing, for mp4 and mkv containers at least).</p>

<p>e.g. <code>mediainfo</code> output:</p>

<pre><code>Complete name             : out.mkv
...
Writing application                      : Lavf57.14.100
Writing library                          : Lavf57.14.100


Video
ID                                       : 1
Format                                   : AVC
...
Writing library                          : x264 core 148 r2638+4 afcf21c
Encoding settings                        : cabac=1 / ref=8 / ...
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
</code></pre>

<hr>

<p>So bt.709 is easy to tag.  The problem is, I don't see bt.601 anywhere.  Is one of other names an alias for it, or is there really no way to specify it explicitly?</p>

<pre><code>x264 --fullhelp output:

  --colorprim &lt;string&gt;    Specify color primaries ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, film, bt2020
  --transfer &lt;string&gt;     Specify transfer characteristics ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, linear, log100, log316,
                                iec61966-2-4, bt1361e, iec61966-2-1,
                                bt2020-10, bt2020-12
  --colormatrix &lt;string&gt;  Specify color matrix setting ["???"]
                              - undef, bt709, fcc, bt470bg, smpte170m,
                                smpte240m, GBR, YCgCo, bt2020nc, bt2020c
</code></pre>

<p><code>ffmpeg -h full</code>  shows the same set of options for its color options, which ffmpeg's <code>-c:v libx264</code> video codec passes on to x264.  Is any of these an alias for bt.601, or have a numerically equivalent colour matrix?</p>

CC BY-SA 3.0
2016-08-04T14:13:58.780Z
I have the exact same problem. Did you figure out the command line to use to get h264 HD footage tagged with BT.601?
Casper
CC BY-SA 3.0
2016-08-04T15:15:46.060Z
@Casper: yes, I accepted Mulvya's answer because it was plenty of info to look up the right options.  I made an edit to include the right options explicitly (e.g. NTSC is `-color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m`).
Peter Cordes
<ffmpeg><h.264><colorspace><metadata>
ffmpeg: explicitly tag h.264 as bt.601, rather than leaving unspecified?
Peter Cordes
# ffmpeg: explicitly tag h.264 as bt.601, rather than leaving unspecified?

(Asked by: username_0 on 2015-11-07)

I want to tag video as explicitly bt.601, rather than "unspecified".  I know players typically choose bt.601 as the default for videos less than 1280 pixels wide, but I want to make it explicit that bt.601 is the correct colour matrix for a video.
The sticking point is that there is no bt601 option for ffmpeg or libx264, only bt709 and some others.
I have some videos that were downscaled from HD, and are still in bt.709, but aren't tagged properly.  So when I watch a video, I sometimes have to manually toggle my player to bt.709.  Tagging explicitly as bt.601 will communicate to future viewers (e.g. myself) that it's definitely bt.601, and not a mis-tagged bt.709 video, when I look at it with mediainfo.
Another use-case for this would be if you upscaled a bt.601 video to 1280 or higher without doing a colormatrix conversion (using -vf colormatrix), players would incorrectly assume bt.709 if you left the color information unspecified.
FFMpeg's colormatrix video filter does support bt601 as an input or output color matrix, but doesn't also set tags.  (Since it doesn't have the side-effect of setting ffmpeg's color options, it refuses to even operate with src and dest the same, like -vf colormatrix=bt601:bt601.)

ffmpg in  -color_primaries bt709 -color_trc bt709 -colorspace bt709  out

will tag the output video as using bt.709 for yuv<->rgb.  The tags end up inside the video bitstream itself, not just in the container (since this is seems to be a codec-specific thing, not a container thing, for mp4 and mkv containers at least).
e.g. mediainfo output:
Complete name             : out.mkv
...
Writing application                      : Lavf57.14.100
Writing library                          : Lavf57.14.100


Video
ID                                       : 1
Format                                   : AVC
...
Writing library                          : x264 core 148 r2638+4 afcf21c
Encoding settings                        : cabac=1 / ref=8 / ...
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709


So bt.709 is easy to tag.  The problem is, I don't see bt.601 anywhere.  Is one of other names an alias for it, or is there really no way to specify it explicitly?
x264 --fullhelp output:

  --colorprim     Specify color primaries ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, film, bt2020
  --transfer      Specify transfer characteristics ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, linear, log100, log316,
                                iec61966-2-4, bt1361e, iec61966-2-1,
                                bt2020-10, bt2020-12
  --colormatrix   Specify color matrix setting ["???"]
                              - undef, bt709, fcc, bt470bg, smpte170m,
                                smpte240m, GBR, YCgCo, bt2020nc, bt2020c

ffmpeg -h full  shows the same set of options for its color options, which ffmpeg's -c:v libx264 video codec passes on to x264.  Is any of these an alias for bt.601, or have a numerically equivalent colour matrix?

**Tags:** ffmpeg, h.264, colorspace, metadata

> **Comments:**
> **username_1**: I have the exact same problem. Did you figure out the command line to use to get h264 HD footage tagged with BT.601?  
> **username_0**: @username_1: yes, I accepted Mulvya's answer because it was plenty of info to look up the right options.  I made an edit to include the right options explicitly (e.g. NTSC is `-color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m`).  

---

## 1 answers

### Answer by username_2 on 2015-11-08. Score: 17 | Accepted answer

PAL and NTSC have different color primaries, so 
NTSC = SMPTE 170M = BT 601 525
PAL = BT 470 BG = BT 601 625
See the rows for value 5 & 6 on the table on page 387 of the active H.264 standard.

So the right args for ffmpeg are:
NTSC:
# NTSC
ffmpeg -i input  \
 -colorspace smpte170m -color_primaries smpte170m -color_trc smpte170m

mediainfo:
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601

PAL:
-color_trc doesn't accept bt470bg, but ffmpeg -h full shows that gamma28 means "BT.470 BG" for that option.
# PAL
ffmpeg -i input  \
 -colorspace bt470bg -color_primaries bt470bg -color_trc gamma28

mediainfo:
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.470 System B, BT.470 System G
Matrix coefficients                      : BT.601

-colorspace is the most important option; the others don't make a visible difference for software players like mpv on Linux.

> **Comments:**
> **username_0**: Ah of course.  I was even looking at the bt601 wikipedia page, and didn't clue in from the table having two rows.  Derp.  
> **username_3**: For those looking to do this same setting with HandBrake, under the Video tab, inside the Extra Options edit box, enter this string: "colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m"  

---

