Opened 8 years ago

Closed 8 years ago

#5432 closed defect (invalid)

Incorrect colors using filter-complex pad

Reported by: Paul Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: pad
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When combining 2 images/videos into a side-by-side composition using filter_complex (pad), the color/brightness of the left image is slightly incorrect. It is hard to tell by simply looking at the image, but it is obvious in dark scenes and when using a scope.

How to reproduce:

ffmpeg -loop 1 -i smpte2.png -i smpte2.png -filter_complex "[0:v:0]pad=iw*2:ih[bg];[bg][1:v:0]overlay=w" -pix_fmt yuv420p  -map 0:v -b:v:0 9000k -s:v:0 3840x1080 -map 0:a:0? -t 5 test.mp4

Using version N-79344-g196cfc2

Attachments (2)

SBS Encoding w Points.jpg (1.0 MB ) - added by Paul 8 years ago.
SBS Encoded with Scope
smpte2.png (14.4 KB ) - added by Paul 8 years ago.
Test file

Download all attachments as: .zip

Change History (9)

by Paul, 8 years ago

Attachment: SBS Encoding w Points.jpg added

SBS Encoded with Scope

by Paul, 8 years ago

Attachment: smpte2.png added

Test file

comment:1 by Paul, 8 years ago

Keywords: filter-complex pad sbs overlay added

comment:2 by Paul, 8 years ago

To further clarify, it seems that toward the lower end of the brightness spectrum (per color) everything is crushed/darkened/lower than it should be, and toward the higher end everything is brighter/higher than it should be -- like the brightness is being stretched too low and too high.

comment:3 by llogan, 8 years ago

Keywords: filter-complex sbs overlay removed

Please include the complete console output from your command: this is required information.

in reply to:  3 comment:4 by Paul, 8 years ago

Replying to llogan:

Please include the complete console output from your command: this is required information.

ffmpeg\bin>ffmpeg -loop 1 -i smpte2.png -i smpte2.png -filter_complex "[0:v:0]pad=iw*2:ih[bg];[bg][1:v:0]overlay=w" -pix_fmt yuv420p  -map 0:v -b:v:0 9000k -s:v:0 3840x1080 -map 0:a:0? -t 5 test.mp4
ffmpeg version N-79344-g196cfc2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 20.100 / 55. 20.100
  libavcodec     57. 34.100 / 57. 34.100
  libavformat    57. 33.100 / 57. 33.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 41.100 /  6. 41.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'smpte2.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1266x720 [SAR 2835:2835 DAR 211:120], 25 fps, 25 tbr, 25 tbn
Input #1, png_pipe, from 'smpte2.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgb24(pc), 1266x720 [SAR 2835:2835 DAR 211:120], 25 tbr, 25 tbn
[libx264 @ 0000000002a90c60] using SAR=633/640
[libx264 @ 0000000002a90c60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000002a90c60] profile High, level 5.0
[libx264 @ 0000000002a90c60] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=9000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0000000000f7bda0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf57.33.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 3840x1080 [SAR 633:640 DAR 211:60], q=2-31, 9000 kb/s, 25 fps, 12800 tbn (default)
    Metadata:
      encoder         : Lavc57.34.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/9000000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (png) -> pad
  Stream #1:0 (png) -> overlay:overlay
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  125 fps= 38 q=-1.0 Lsize=      60kB time=00:00:04.88 bitrate= 100.6kbits/s speed=1.47x
video:58kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.993426%
[libx264 @ 0000000002a90c60] frame I:1     Avg QP: 3.96  size: 13599
[libx264 @ 0000000002a90c60] frame P:31    Avg QP: 1.49  size:  1002
[libx264 @ 0000000002a90c60] frame B:93    Avg QP: 0.64  size:   147
[libx264 @ 0000000002a90c60] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
[libx264 @ 0000000002a90c60] mb I  I16..4: 95.0%  2.3%  2.7%
[libx264 @ 0000000002a90c60] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4:  0.3%  0.0%  0.0%  0.0%  0.0%    skip:99.3%
[libx264 @ 0000000002a90c60] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.2%  0.0%  0.0%  direct: 0.0%  skip:99.8%  L0:29.6% L1:70.4% BI: 0.0%
[libx264 @ 0000000002a90c60] final ratefactor: -22.22
[libx264 @ 0000000002a90c60] 8x8 transform intra:2.4% inter:58.6%
[libx264 @ 0000000002a90c60] coded y,uvDC,uvAC intra: 3.5% 7.4% 6.3% inter: 0.0% 0.0% 0.0%
[libx264 @ 0000000002a90c60] i16 v,h,dc,p: 86% 14%  0%  0%
[libx264 @ 0000000002a90c60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 78%  9% 13%  0%  0%  0%  0%  0%  0%
[libx264 @ 0000000002a90c60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 49% 14%  0%  0%  0%  0%  0%  1%
[libx264 @ 0000000002a90c60] i8c dc,h,v,p: 66% 19% 15%  0%
[libx264 @ 0000000002a90c60] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002a90c60] ref P L0: 97.6%  0.1%  2.4%
[libx264 @ 0000000002a90c60] ref B L0: 10.0% 89.8%  0.1%
[libx264 @ 0000000002a90c60] kb/s:93.31

ffmpeg\bin>

comment:5 by Carl Eugen Hoyos, 8 years ago

Your summary indicates that you believe there is an issue withe the pad filter. For your input sample, the pad filter only adds black pixels on the right side of your frame, nothing else is changed so there cannot be an issue with the provided input sample and the pad filter.

Is libx264 needed to reproduce the issue or is it also reproducible with -qscale 2 -vcodec mpeg4?
Why are you using the option -s? This can be a bad idea in connection with a non-trivial filter chain.

comment:6 by Elon Musk, 8 years ago

Use hstack filter for this. Also your rgb is in bt601 colorspace. Which may be interpreted as 709.

comment:7 by Paul, 8 years ago

Resolution: invalid
Status: newclosed

I am closingthis ticket, it seems to be related to an NVIDIA Surround issue, not ffmpeg. Thank you for your help!

Note: See TracTickets for help on using tickets.