Opened 12 years ago
Last modified 12 years ago
#2559 open defect
Bad pixel format negociation with scale and gray
Reported by: | Clément Bœsch | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | pixfmt |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
The gray pixel format seems to be preferred over colored output sometimes.
Working fine:
% ./ffplay -nostats -v verbose -f lavfi testsrc -vf 'split[a][b]; [a]pad=iw*2[x]; [b]edgedetect[y]; [x][y]overlay=w' ffplay version N-52968-g90d35e5 Copyright (c) 2003-2013 the FFmpeg developers built on May 11 2013 12:34:21 with gcc 4.8.0 (GCC) 20130502 (prerelease) configuration: --enable-gpl --enable-version3 --enable-fontconfig --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-x11grab --enable-libopenjpeg --enable-libass --enable-libmodplug --enable-libv4l2 --cc=colorgcc --samples=/home/ubitux/fate-samples --prefix=/tmp/ffinstall --disable-runtime-cpudetect --enable-libcelt --enable-libopencv --enable-frei0r --enable-libcaca --enable-libiec61883 --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libopus --enable-libpulse --enable-libspeex --enable-libquvi --enable-memory-poisoning libavutil 52. 30.100 / 52. 30.100 libavcodec 55. 7.100 / 55. 7.100 libavformat 55. 4.101 / 55. 4.101 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 64.100 / 3. 64.100 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [Parsed_testsrc_0 @ 0x7f84fc001600] size:320x240 rate:25/1 duration:-1.000000 sar:1/1 [ffplay_buffer @ 0x7f84f0000dc0] w:320 h:240 pixfmt:rgb24 tb:1/25 fr:25/1 sar:1/1 sws_param: [auto-inserted scaler 0 @ 0x7f84f0006e80] w:0 h:0 flags:'4' interl:0 [Parsed_edgedetect_2 @ 0x7f84f0005880] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_split_0' and the filter 'Parsed_edgedetect_2' [auto-inserted scaler 1 @ 0x7f84f0002620] w:0 h:0 flags:'4' interl:0 [Parsed_overlay_3 @ 0x7f84f00060a0] auto-inserting filter 'auto-inserted scaler 1' between the filter 'Parsed_pad_1' and the filter 'Parsed_overlay_3' [auto-inserted scaler 2 @ 0x7f84f00011c0] w:0 h:0 flags:'4' interl:0 [Parsed_overlay_3 @ 0x7f84f00060a0] auto-inserting filter 'auto-inserted scaler 2' between the filter 'Parsed_edgedetect_2' and the filter 'Parsed_overlay_3' [Parsed_pad_1 @ 0x7f84f0004aa0] w:320 h:240 -> w:640 h:240 x:0 y:0 color:0x000000FF [auto-inserted scaler 1 @ 0x7f84f0002620] w:640 h:240 fmt:rgb24 sar:1/1 -> w:640 h:240 fmt:yuv420p sar:1/1 flags:0x4 [auto-inserted scaler 0 @ 0x7f84f0006e80] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:gray sar:1/1 flags:0x4 [auto-inserted scaler 2 @ 0x7f84f00011c0] w:320 h:240 fmt:gray sar:1/1 -> w:320 h:240 fmt:yuva420p sar:1/1 flags:0x4 [Parsed_overlay_3 @ 0x7f84f00060a0] main w:640 h:240 fmt:yuv420p overlay w:320 h:240 fmt:yuva420p [ffplay_crop @ 0x7f84f00030c0] w:640 h:240 sar:1/1 -> w:640 h:240 sar:1/1
Broken with a scale filter (the left is part is being "contaminated" with the gray-only:
% ./ffplay -nostats -v verbose -f lavfi testsrc -vf 'scale=iw:ih, split[a][b]; [a]pad=iw*2[x]; [b]edgedetect[y]; [x][y]overlay=w' ffplay version N-52968-g90d35e5 Copyright (c) 2003-2013 the FFmpeg developers built on May 11 2013 12:34:21 with gcc 4.8.0 (GCC) 20130502 (prerelease) configuration: --enable-gpl --enable-version3 --enable-fontconfig --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-x11grab --enable-libopenjpeg --enable-libass --enable-libmodplug --enable-libv4l2 --cc=colorgcc --samples=/home/ubitux/fate-samples --prefix=/tmp/ffinstall --disable-runtime-cpudetect --enable-libcelt --enable-libopencv --enable-frei0r --enable-libcaca --enable-libiec61883 --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libopus --enable-libpulse --enable-libspeex --enable-libquvi --enable-memory-poisoning libavutil 52. 30.100 / 52. 30.100 libavcodec 55. 7.100 / 55. 7.100 libavformat 55. 4.101 / 55. 4.101 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 64.100 / 3. 64.100 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [Parsed_testsrc_0 @ 0x7fd048001600] size:320x240 rate:25/1 duration:-1.000000 sar:1/1 [ffplay_buffer @ 0x7fd04c000dc0] w:320 h:240 pixfmt:rgb24 tb:1/25 fr:25/1 sar:1/1 sws_param: [Parsed_scale_0 @ 0x7fd04c004160] w:iw h:ih flags:'4' interl:0 [auto-inserted scaler 0 @ 0x7fd04c000b80] w:0 h:0 flags:'4' interl:0 [Parsed_overlay_4 @ 0x7fd04c007100] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_pad_2' and the filter 'Parsed_overlay_4' [auto-inserted scaler 1 @ 0x7fd04c006e00] w:0 h:0 flags:'4' interl:0 [Parsed_overlay_4 @ 0x7fd04c007100] auto-inserting filter 'auto-inserted scaler 1' between the filter 'Parsed_edgedetect_3' and the filter 'Parsed_overlay_4' [Parsed_scale_0 @ 0x7fd04c004160] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:gray sar:1/1 flags:0x4 [Parsed_pad_2 @ 0x7fd04c005b40] w:320 h:240 -> w:640 h:240 x:0 y:0 color:0x000000FF [auto-inserted scaler 0 @ 0x7fd04c000b80] w:640 h:240 fmt:gray sar:1/1 -> w:640 h:240 fmt:yuv420p sar:1/1 flags:0x4 [auto-inserted scaler 1 @ 0x7fd04c006e00] w:320 h:240 fmt:gray sar:1/1 -> w:320 h:240 fmt:yuva420p sar:1/1 flags:0x4 [Parsed_overlay_4 @ 0x7fd04c007100] main w:640 h:240 fmt:yuv420p overlay w:320 h:240 fmt:yuva420p [ffplay_crop @ 0x7fd04c0030c0] w:640 h:240 sar:1/1 -> w:640 h:240 sar:1/1
Change History (7)
comment:1 by , 12 years ago
follow-up: 3 comment:2 by , 12 years ago
I don't think this is a valid ticket: FFmpeg tries to only insert the scale filter once and succeeds.
comment:3 by , 12 years ago
Replying to cehoyos:
I don't think this is a valid ticket: FFmpeg tries to only insert the scale filter once and succeeds.
I see 2 auto-inserted filters, in addition to the explicit scale filter. And that behavior is not expected anyway; if a user wants to reduce the amount of auto-inserted filter, he can insert a format filter to pre-convert to gray.
follow-up: 5 comment:4 by , 12 years ago
cehoyos is right, the behaviour is normal.
The auto-inserted filters are on the pad-overlay and edgedetect-overlay links, they are completely unrelated to the problem at hand, which happens on the input side of edgedetect.
Note that you can get the same result without inserting the scale filter: just move the edgedetect definition before the split filter.
I do not think that "solving" this kind of problem is a practical solution. At some point, users need to realize that complex filter graph sometimes need explicit format specification.
comment:5 by , 12 years ago
Replying to Cigaes:
cehoyos is right, the behaviour is normal.
The auto-inserted filters are on the pad-overlay and edgedetect-overlay links, they are completely unrelated to the problem at hand, which happens on the input side of edgedetect.
Note that you can get the same result without inserting the scale filter: just move the edgedetect definition before the split filter.
I do not think that "solving" this kind of problem is a practical solution. At some point, users need to realize that complex filter graph sometimes need explicit format specification.
While this behaviour might be "normal" with the current design, I don't understand how that can be the expected one.
How can a user know if he needs explicit format specification or no (except by observing random craziness in some cases)?
...and I still believe the "lossless" path should be prefered over the "optimized" one. Inserting a gray auto-scaler in this place "sometimes" is IMO a non-sense from a user experience PoV.
So while this might not be considered a bug in itself, it can be stated as a design problem or current limitation nevertheless. Feel free to reword and re-qualify the ticket.
comment:6 by , 12 years ago
Keywords: | pixfmt added |
---|---|
Reproduced by developer: | set |
Status: | new → open |
comment:7 by , 12 years ago
IMHO one of multiple outputs of a split filter should not cause the other outputs to loose chroma or alpha but thats what happens. A similar issue could arise with "merge" filters
Note: this was originally reported in #2465.