[FFmpeg-user] preserving YUV color range of 0-255
Dave Rice
dave at dericed.com
Fri Mar 7 18:53:09 CET 2014
On Mar 7, 2014, at 12:37 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Dave Rice <dave <at> dericed.com> writes:
>
>> Given that the test pattern has U and V at 128 I
>> would expect these two commands to give the same results:
>>
>> ffplay 256shades_ntsc.mov
>> -vf 'histogram=mode=waveform:waveform_mode=column'
>> ffplay 256shades_ntsc.mov
>> -vf 'extractplanes=y,histogram=mode=waveform:waveform_mode=column'
>
> Is the problem you see reproducible with ffmpeg?
>
> ffplay is an application that depends on an external
> library that is known to contain bugs, so if the
> problem is reproducible with ffmpeg, please explain
> how.
> (Ideally, command line and complete, uncut console
> output.)
Yes, the issue is the same via ffmpeg.
Here is the output when using histogram=mode=waveform:waveform_mode=column on a source that uses full range YUV.
ffmpeg -i 256shades_ntsc.mov -vf 'histogram=mode=waveform:waveform_mode=column' -frames:v 1 -y histogram_only.jpg
ffmpeg version 2.2.git Copyright (c) 2000-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
[swscaler @ 0x7fa1e3000000] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'histogram_only.jpg':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.33.101
Stream #0:0(eng): Video: mjpeg, yuvj422p, 720x768 [SAR 1:1 DAR 15:16], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc (default)
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mjpeg)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=4.0 Lsize=N/A time=00:00:00.03 bitrate=N/A
video:20kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -100.106201%
The resulting file is here http://dericed.com/media/extractplanes_then_histogram.jpg. It shows essentially a diagonal line in the Y plane representing values 0-255.
Here is the output for the same command as above but adding extractplanes=y at the beginning of the filterchain:
ffmpeg -i 256shades_ntsc.mov -vf 'extractplanes=y,histogram=mode=waveform:waveform_mode=column' -frames:v 1 -y extractplanes_then_histogram.jpg
ffmpeg version 2.2.git Copyright (c) 2000-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
[swscaler @ 0x7fb7e8812400] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'extractplanes_then_histogram.jpg':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.33.101
Stream #0:0(eng): Video: mjpeg, yuvj444p, 720x768 [SAR 1:1 DAR 15:16], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc (default)
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mjpeg)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=4.0 Lsize=N/A time=00:00:00.03 bitrate=N/A
video:27kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -100.080383%
And here is the resulting image http://dericed.com/media/histogram_only.jpg. Instead of the diagonal line as before the values from 0-15 and 236-255 are crushed to the same value.
Best Regards,
Dave Rice
More information about the ffmpeg-user
mailing list