[FFmpeg-trac] #4978(swscale:new): Color range is wrong in media players, correct in PNG output

FFmpeg trac at avcodec.org
Sun Nov 1 16:59:22 CET 2015


#4978: Color range is wrong in media players, correct in PNG output
---------------------------------+---------------------------------------
             Reporter:  Sesse    |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  swscale  |                  Version:  unspecified
             Keywords:           |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+---------------------------------------
 Hi,

 I've been trying to track down an issue where the colors are too muted in
 media players (MPlayer, VLC, ffplay all behave identically). I made a
 H.264 file that contains only the Y'CbCr triplet (63,102,240), which
 should be a pure red, and have explicitly set the limited-range flag. (If
 I specify full-range, saturation becomes correct but the luma range gets
 wrong.) I have verified with raw YUV output that these value indeed came
 correct through the encoder.

 ffprobe correctly understands that TV range is in use:

 {{{
 ffprobe version 2.8.1 Copyright (c) 2007-2015 the FFmpeg developers
   built with gcc 5.2.1 (Debian 5.2.1-23) 20151028
   configuration:
   libavutil      54. 31.100 / 54. 31.100
   libavcodec     56. 60.100 / 56. 60.100
   libavformat    56. 40.101 / 56. 40.101
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 40.101 /  5. 40.101
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  2.101 /  1.  2.101
 Input #0, mpegts, from '/home/sesse/dev/nageru/test.ts':
   Duration: 00:00:01.47, start: 0.083333, bitrate: 473 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(tv, bt709), 1280x720, 60 tbr, 90k tbn, 120k tbc
     Stream #0:1[0x101]: Audio: mp3 ([3][0][0][0] / 0x0003), 48000 Hz,
 stereo, s16p, 256 kb/s
 }}}

 However, if I play with ffplay and take a screenshot (with import from
 ImageMagick), the color comes out as RGB=(233,0,2). This isn't right.

 I was wondering if I had set something wrong in the flags, but then I
 tried PNG output:

 {{{
 klump:~/nmu/ffmpeg-2.8.1> ./ffmpeg -i ~/dev/nageru/test.ts test%03d.png
 }}}

 Opening one of these PNG files show that the output color is
 RGB=(254,0,0), which is the correct one!

 FWIW, I've tried -vo x11 in MPlayer, so I'm fairly certain this isn't
 about xv or something similar. I might be missing something, though.

 I've marked this as swscale, since I honestly don't know where this could
 be otherwise.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4978>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list