Opened 3 years ago

Closed 3 years ago

#8424 closed defect (invalid)

Colour changes if scale height

Reported by: Bassquake Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

For some reason, when scaling the height, the colours shift. Skin tones become oranger.

To reproduce (using a 720x576 video as example, to then scale the height by 1 pixel to 577px):

ffmpeg -i "720x576_video.avi" -vf "scale=720:577" -c:v huffyuv "output.avi"
ffmpeg version: 96012
built on windows 10 x64

This is only an example of using 1px scale. Colour changes whatever its set as including minus figures.

Colour shift doesn't happen if alter scale width.

So if do:

ffmpeg -i "720x576_video.avi" -vf "scale=721:576" -c:v huffyuv "output.avi"

Colours are correct.

Attachments (2)

colour-shift.png (410.9 KB ) - added by Bassquake 3 years ago.
Screenshot of the problem.
input.avi (2.2 MB ) - added by Bassquake 3 years ago.
15 frame clip due to size limitation

Change History (11)

by Bassquake, 3 years ago

Attachment: colour-shift.png added

Screenshot of the problem.

comment:1 by Carl Eugen Hoyos, 3 years ago

Component: ffmpegundetermined
Keywords: colour shift removed

Please provide the input sample file and the command line you tested together with the complete, uncut console output to make this a valid ticket.

by Bassquake, 3 years ago

Attachment: input.avi added

15 frame clip due to size limitation

comment:2 by Bassquake, 3 years ago

Ok. As requested:

Command (resize height by 1 pixel):

ffmpeg -i "input.avi" -vf "scale=720:577" -y -c:v huffyuv "output.avi"

Log:

ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'input.avi':
  Duration: 00:00:02.40, start: 0.000000, bitrate: 30378 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 29288 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo (native) -> huffyuv (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[huffyuv @ 06afec80] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 06aff040] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 06aff440] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 06aff840] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 09ad0000] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 09ad1f40] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 09ad0f80] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 09ad0bc0] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 06aa5b40] using huffyuv 2.2.0 or newer interlacing flag
Output #0, avi, to 'output.avi':
  Metadata:
    ISFT            : Lavf58.29.100
    Stream #0:0: Video: huffyuv (HFYU / 0x55594648), yuv422p, 720x577 [SAR 577:540 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.54.100 huffyuv
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc58.54.100 libmp3lame
frame=   60 fps=0.0 q=-0.0 Lsize=   24376kB time=00:00:02.40 bitrate=83204.8kbits/s speed=24.3x
video:24325kB audio:38kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.056110%

Video clip attached.

Last edited 3 years ago by Bassquake (previous) (diff)

comment:3 by Carl Eugen Hoyos, 3 years ago

Why did you change the FFmpeg version you tested? Is the issue not reproducible with current FFmpeg?

comment:4 by Bassquake, 3 years ago

I used the official build for the latest log. It does the same thing.

Anyway, I think I solved it by adding this to the filters:

colormatrix=bt601:bt709

Skin tones are normal now.

comment:5 by Carl Eugen Hoyos, 3 years ago

For future tickets, please remember that only current FFmpeg git head is supported on this bug tracker and that there are no official builds (the FFmpeg project only provides source code).

Do I understand correctly that there is no issue?

comment:6 by Bassquake, 3 years ago

Ok no problem. I originally tried the media-autobuild_suite version which pulls the latest from git. Then tested with the windows build from ffmpeg.org. Had same issue.

Issue is solved as long as I add colormatrix conversion. Still, it's a bit weird it's needed if do any vertical scaling but not if do horizontal scaling.

Will close this ticket.

comment:7 by pdr0, 3 years ago

This actual has nothing to do with ffmpeg ;

It's the software you are using for playback, and how it converts to RGB for display. Some players use the criteria of "height" to determine if something is "HD" and use Rec709. So they use Rec709 when height >576 , Rec601 when height <=576. Essentially it's the "HD" vs. "SD" cutoff. But the handling can be different in other software, video editors. There are other factors, such as the format used, metadata flags which may affect how it's handled. For example, huffyuv will often get 601 treatment in some editors, even when 720 or 1080 height.

comment:8 by Bassquake, 3 years ago

Yeah looks like a VLC issue. It still colour shifts if downsized too.

comment:9 by Bassquake, 3 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.