[FFmpeg-trac] #8056(undetermined:new): Convert BMP/JPG to YUV420p video color shift, but not PNG

FFmpeg trac at avcodec.org
Wed Sep 11 01:43:33 EEST 2019


#8056: Convert BMP/JPG to YUV420p video color shift, but not PNG
-------------------------------------+-------------------------------------
             Reporter:  fireattack   |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by CoRoNe):

 * cc: rwijnsma@… (added)


Comment:

 I'm not an expert in this field of work, but I can confirm the
 "yellowness" (if it's really a bug).

 While '//png.png//' is marked as `rgb24(pc)` (full range), '//bmp.bmp//'
 is marked as just `bgr24` (no range set). So apparently you have to
 convert to full range yourself.

 https://ffmpeg.org/ffmpeg-all.html#Codec-Options:
 > '''color_range ''integer (decoding/encoding,video)'''''
 > If used as input parameter, it serves as a hint to the decoder, which
 color_range the input has.
 {{{
 ffmpeg -loop 1 -color_range pc -i bmp.bmp -t 10 -pix_fmt yuv420p -preset
 ultrafast bmp.mp4
 }}}
 With `-color_range pc` '//bmp.bmp//' is now marked as `bgr24(pc)`, but the
 "bmp decoder" seems to be ignorant of this hint, because '//bmp.mp4//' is
 still 252,255,252 (#FCFFFC).

 What does work which I found out:
 {{{
 ffmpeg -loop 1 -i bmp.bmp -t 10 -vf scale=out_range=pc -pix_fmt yuv420p
 -preset ultrafast bmp.mp4
 ffmpeg -loop 1 -i bmp.bmp -t 10 -vf
 colorspace=iall=bt709:all=bt709:format=yuv420p -preset ultrafast bmp.mp4
 }}}
 (I noticed the first command to be twice as fast than the second)

 Btw, there's no need for intermediate files. You can use FFplay:
 {{{
 ffplay -f lavfi color=white:s=1280x720,format=bgr24,format=yuv420p
 # 252,255,252 (#FCFFFC)
 ffplay -f lavfi color=white:s=1280x720,format=rgb24,format=yuv420p
 # 255,255,255 (#FFFFFF)
 ffplay -f lavfi
 color=white:s=1280x720,format=bgr24,scale=out_range=pc,format=yuv420p   #
 255,255,255 (#FFFFFF)
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8056#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list