Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2465 closed defect (fixed)

Hue filter bug after scale and padding

Reported by: Bernardo Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: hue regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The "hue" filter will show some errors in the final image when shown side by side with the original video after it was scaled down. The errors look like shadows from other frames.

Example attatched.

If the "scale" filter is removed, the video appears normal. This will only happen with the "hue" filter... The others I tried worked fine.

How to reproduce:

$ ffmpeg -i Madeon_Pop_Culture.flv -filter:v 'scale=320:trunc(ow/a/2)*2, split[a][b]; [a]pad=iw*2[aa]; [b]hue=h=45[bb]; [aa][bb]overlay=w' -t 10 -c:a copy -b:v 800k side_by_side.mp4

ffmpeg version N-41160-g9fa3b5b Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 12 2013 14:45:58 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-libfreetype
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 53.101 /  3. 53.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, flv, from 'Madeon_Pop_Culture.flv':
  Metadata:
    starttime       : 0
    totalduration   : 235
    totaldatarate   : 1256
    bytelength      : 36921553
    canseekontime   : true
    sourcedata      : BADC21B01HH1323804013818706
    purl            : 
    pmsg            : 
  Duration: 00:03:55.15, start: 0.000000, bitrate: 1256 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p, 854x480, 1148 kb/s, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 129 kb/s
[libx264 @ 0x1c19800] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0x1c19800] profile High, level 2.1
[libx264 @ 0x1c19800] 264 - core 130 r60 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=6 lookahead_threads=1 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=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'side_by_side.mp4':
  Metadata:
    starttime       : 0
    totalduration   : 235
    totaldatarate   : 1256
    bytelength      : 36921553
    canseekontime   : true
    sourcedata      : BADC21B01HH1323804013818706
    purl            : 
    pmsg            : 
    encoder         : Lavf55.2.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x178, q=-1--1, 800 kb/s, 24k tbn, 23.98 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 129 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  240 fps=106 q=-1.0 Lsize=    1137kB time=00:00:10.00 bitrate= 930.5kbits/s    
video:973kB audio:155kB subtitle:0 global headers:0kB muxing overhead 0.768025%
[libx264 @ 0x1c19800] frame I:2     Avg QP:23.66  size: 18150
[libx264 @ 0x1c19800] frame P:127   Avg QP:27.13  size:  6102
[libx264 @ 0x1c19800] frame B:111   Avg QP:31.41  size:  1663
[libx264 @ 0x1c19800] consecutive B-frames:  9.2% 86.7%  2.5%  1.7%
[libx264 @ 0x1c19800] mb I  I16..4: 26.9% 38.6% 34.5%
[libx264 @ 0x1c19800] mb P  I16..4:  3.8%  4.9%  2.3%  P16..4: 43.1% 18.2% 15.9%  0.0%  0.0%    skip:11.7%
[libx264 @ 0x1c19800] mb B  I16..4:  0.5%  1.6%  0.3%  B16..8: 40.3%  8.3%  2.9%  direct: 8.1%  skip:37.9%  L0:47.6% L1:37.6% BI:14.8%
[libx264 @ 0x1c19800] final ratefactor: 23.60
[libx264 @ 0x1c19800] 8x8 transform intra:47.1% inter:59.2%
[libx264 @ 0x1c19800] coded y,uvDC,uvAC intra: 50.4% 41.2% 15.9% inter: 38.3% 28.8% 10.8%
[libx264 @ 0x1c19800] i16 v,h,dc,p: 76% 12%  4%  8%
[libx264 @ 0x1c19800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 16% 23%  4%  3%  3%  5%  5%  8%
[libx264 @ 0x1c19800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 29% 10%  5%  4%  4%  5%  5%  7%
[libx264 @ 0x1c19800] i8c dc,h,v,p: 68% 15% 14%  3%
[libx264 @ 0x1c19800] Weighted P-Frames: Y:9.4% UV:8.7%
[libx264 @ 0x1c19800] ref P L0: 40.8% 13.1% 26.9% 16.6%  2.6%
[libx264 @ 0x1c19800] ref B L0: 66.7% 33.1%  0.2%
[libx264 @ 0x1c19800] ref B L1: 98.8%  1.2%
[libx264 @ 0x1c19800] kb/s:795.90


Attachments (2)

side_by_side.mp4 (1.1 MB ) - added by Bernardo 10 years ago.
Errors on right side video
side_by_side_edge.mp4 (1.1 MB ) - added by Bernardo 10 years ago.
Edgedetect error

Change History (16)

by Bernardo, 10 years ago

Attachment: side_by_side.mp4 added

Errors on right side video

comment:1 by Carl Eugen Hoyos, 10 years ago

Keywords: hue added

Is libx264 necessary to reproduce the problem or is -vcodec mpeg4 sufficient (and -an)?
It is very, very rare that output files (side_by_side.mp4) are useful, input files are always needed.

Is it possible to further simplify your command line?

comment:2 by Bernardo, 10 years ago

Sorry, the command line is the simplest possible. It is just a filterchain.
I tried with some files and all gave the same result. I will upload the original

The error also shows on ffplay, so I assume libx264 is not the problem


Another error:

When scaled down, the "edgedetect" filter will make the original output black and white. If removed the "scale" filter, everything works fine.

$ ffmpeg -i Madeon_Pop_Culture.flv -filter:v 'scale=320:trunc(ow/a/2)*2, split[a][b]; [a]pad=iw*2[aa]; [b]edgedetect=[bb]; [aa][bb]overlay=w' -t 10 -c:a copy -b:v 800k side_by_side_edge.mp4

Another example attatched.

by Bernardo, 10 years ago

Attachment: side_by_side_edge.mp4 added

Edgedetect error

comment:3 by Bernardo, 10 years ago

Here is the original video to reproduce both errors:

http://www1.datafilehost.com/d/0cbaa6ac

comment:4 by Bernardo, 10 years ago

Summary: Hue filter bug after scale and paddingHue/Edgedetect filter bug after scale and padding

in reply to:  2 comment:5 by Carl Eugen Hoyos, 10 years ago

Replying to jbvsmo:

Another error:

Please open a new ticket (unless this is the same problem), reporting several independent bugs in one ticket makes following the tickets impossible.
If a problem is reproducible with ffmpeg, please do not report it with ffplay, ffplay depends on an external libraries that is known to be buggy.

comment:6 by Bernardo, 10 years ago

Those are probably the same bug (related to the scale action)

The filter graph is like this:

input --> scale --> split ---> pad=iw*2 ---> overlay=w --> output
                     |                          ^
                     |                          |
                     +------> some_filter ------+

The "some_filter" is what changed. With "hue" and "edgedetect", something weird will appear, but it is related to the "scale" filter

If you remove the "scale" step, the output will be fine!

comment:7 by Bernardo, 10 years ago

Also, I didn't reported it with ffplay. The output above is from ffmpeg.

I said:

The error also shows on ffplay, so I assume libx264 is not the problem

comment:8 by Elon Musk, 10 years ago

The hue bug should be fixed in latest master.

in reply to:  8 comment:9 by Bernardo, 10 years ago

Replying to richardpl:

The hue bug should be fixed in latest master.

I compiled my FFmpeg from master one hour ago. Are you saying it was fixed now or it was already fixed?

comment:10 by Elon Musk, 10 years ago

One hour ago is too old, it was fixed several minutes after you reported it.

in reply to:  10 comment:11 by Bernardo, 10 years ago

Replying to richardpl:

One hour ago is too old, it was fixed several minutes after you reported it.

That's great! Should I close this bug report and add another for the edgedetect? I now compiled it and it still happens (check the second attachment an the ffmpeg command above)

Last edited 10 years ago by Bernardo (previous) (diff)

comment:12 by Elon Musk, 10 years ago

There is workaround for second issue, add format=yuv420p (or anything that is not gray) after scale filter.

comment:13 by Carl Eugen Hoyos, 10 years ago

Keywords: regression added
Priority: normalimportant
Resolution: fixed
Status: newclosed

Fixed in 047a027
(The effect that the bug produced may be worth a separate filter imo.)

comment:14 by Carl Eugen Hoyos, 10 years ago

Summary: Hue/Edgedetect filter bug after scale and paddingHue filter bug after scale and padding
Note: See TracTickets for help on using tickets.