[FFmpeg-user] preserving YUV color range of 0-255
Paul B Mahol
onemda at gmail.com
Mon Mar 10 10:26:05 CET 2014
On 3/9/14, Dave Rice <dave at dericed.com> wrote:
>
> On Mar 9, 2014, at 4:52 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>
>> Dave Rice <dave <at> dericed.com> writes:
>>
>>> some filters such as extractplanes change the range of the input.
>>
>> I may miss something but I believe that extractplanes neither
>> changes nor does not change the range, it simply outputs the
>> data as it is stored in the input plane (1:1).
>> Depending on the input colour space, this may lead to
>> unexpected results.
>> But I have to admit I had not used the filter before.
>
> Clement gave me a tip to put format=yuv422p first and that worked. So (with
> uyvy422 source) this,
> -vf 'extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> compressed the range of Y, but this
> -vf
> 'format=yuv422p,extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> displays the Y values appropriately.
>
> I don't understand why adding the format filter makes the difference. Here
> are verbose outputs of the two scenarios:
>
> Without format filter (range is altered):
> ffplay -v verbose 256shades_ntsc.mov -vf
> 'extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> ffplay version 2.2.git Copyright (c) 2003-2014 the FFmpeg developers
> built on Mar 6 2014 20:43:26 with Apple LLVM version 5.0 (clang-500.2.79)
> (based on LLVM 3.3svn)
> configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
> --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
> --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang
> --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac
> --enable-libmp3lame --enable-libxvid --enable-ffplay
> libavutil 52. 66.101 / 52. 66.101
> libavcodec 55. 52.102 / 55. 52.102
> libavformat 55. 33.101 / 55. 33.101
> libavdevice 55. 11.100 / 55. 11.100
> libavfilter 4. 3.100 / 4. 3.100
> libavresample 1. 2. 0 / 1. 2. 0
> libswscale 2. 5.101 / 2. 5.101
> libswresample 0. 18.100 / 0. 18.100
> libpostproc 52. 3.100 / 52. 3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '256shades_ntsc.mov':
> Metadata:
> major_brand : qt
> minor_version : 512
> compatible_brands: qt
> encoder : Lavf55.19.102
> Duration: 00:00:00.03, start: 0.000000, bitrate: 164836 kb/s
> Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x486,
> 167793 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
> Metadata:
> handler_name : DataHandler
> [ffplay_buffer @ 0x7fc8e944ece0] w:720 h:486 pixfmt:uyvy422 tb:1/30000
> fr:30000/1001 sar:0/1 sws_param:
> [auto-inserted scaler 0 @ 0x7fc8e944da00] w:iw h:ih flags:'4' interl:0
> [Parsed_extractplanes_0 @ 0x7fc8e94500e0] auto-inserting filter
> 'auto-inserted scaler 0' between the filter 'ffplay_buffer' and the filter
> 'Parsed_extractplanes_0'
> [auto-inserted scaler 1 @ 0x7fc8e944d8c0] w:iw h:ih flags:'4' interl:0
> [Parsed_histogram_1 @ 0x7fc8e9450440] auto-inserting filter 'auto-inserted
> scaler 1' between the filter 'Parsed_extractplanes_0' and the filter
> 'Parsed_histogram_1'
> [auto-inserted scaler 0 @ 0x7fc8e944da00] w:720 h:486 fmt:uyvy422 sar:0/1 ->
> w:720 h:486 fmt:yuv422p sar:0/1 flags:0x4
> [auto-inserted scaler 1 @ 0x7fc8e944d8c0] w:720 h:486 fmt:gray sar:0/1 ->
> w:720 h:486 fmt:yuv420p sar:0/1 flags:0x4
> [ffplay_crop @ 0x7fc8e944cfc0] w:720 h:768 sar:1/1 -> w:720 h:768 sar:1/1
> 0.81 M-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
>
> With format filter (range kept as-is):
> ffplay -v verbose 256shades_ntsc.mov -vf
> 'format=yuv422p,extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> ffplay version 2.2.git Copyright (c) 2003-2014 the FFmpeg developers
> built on Mar 6 2014 20:43:26 with Apple LLVM version 5.0 (clang-500.2.79)
> (based on LLVM 3.3svn)
> configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
> --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
> --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang
> --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac
> --enable-libmp3lame --enable-libxvid --enable-ffplay
> libavutil 52. 66.101 / 52. 66.101
> libavcodec 55. 52.102 / 55. 52.102
> libavformat 55. 33.101 / 55. 33.101
> libavdevice 55. 11.100 / 55. 11.100
> libavfilter 4. 3.100 / 4. 3.100
> libavresample 1. 2. 0 / 1. 2. 0
> libswscale 2. 5.101 / 2. 5.101
> libswresample 0. 18.100 / 0. 18.100
> libpostproc 52. 3.100 / 52. 3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '256shades_ntsc.mov':
> Metadata:
> major_brand : qt
> minor_version : 512
> compatible_brands: qt
> encoder : Lavf55.19.102
> Duration: 00:00:00.03, start: 0.000000, bitrate: 164836 kb/s
> Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x486,
> 167793 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
> Metadata:
> handler_name : DataHandler
> [ffplay_buffer @ 0x7fe81af16e60] w:720 h:486 pixfmt:uyvy422 tb:1/30000
> fr:30000/1001 sar:0/1 sws_param:
> [auto-inserted scaler 0 @ 0x7fe81af1a480] w:iw h:ih flags:'4' interl:0
> [Parsed_format_0 @ 0x7fe81af198c0] auto-inserting filter 'auto-inserted
> scaler 0' between the filter 'ffplay_buffer' and the filter
> 'Parsed_format_0'
> [auto-inserted scaler 1 @ 0x7fe81af1a2e0] w:iw h:ih flags:'4' interl:0
> [ffplay_crop @ 0x7fe81af19480] auto-inserting filter 'auto-inserted scaler
> 1' between the filter 'Parsed_histogram_2' and the filter 'ffplay_crop'
> [auto-inserted scaler 0 @ 0x7fe81af1a480] w:720 h:486 fmt:uyvy422 sar:0/1 ->
> w:720 h:486 fmt:yuv422p sar:0/1 flags:0x4
> [auto-inserted scaler 1 @ 0x7fe81af1a2e0] w:720 h:256 fmt:gray sar:1/1 ->
> w:720 h:256 fmt:yuv420p sar:1/1 flags:0x4
> [ffplay_crop @ 0x7fe81af19480] w:720 h:256 sar:1/1 -> w:720 h:256 sar:1/1
> 0.43 M-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
>
> I also notice that with:
> -vf
> 'format=yuv422p,extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> the histogram filter only plots one channel but without the format filter
> when I run this:
> -vf 'extractplanes=y,histogram=mode=waveform:waveform_mode=column'
> the histogram channel provides a three channel output. The auto-inserted
> scalers of both filterchains are nearly identical so I'm not sure how to
> account for the difference.
Issues you are experiencing have nothing to do with any filter but
with ffplay itself.
As already mentioned, but I will repeat again, extractplanes filter
and histogram filter do not alter any data.
If you still insist that filters alter data or in other way lie about
input give proof.
>
>> Please try to fix your quoting,
>
> I think I just did.
> Dave
>
>> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
More information about the ffmpeg-user
mailing list