[FFmpeg-user] ffplay with -vf histogram | waveform at full range luma
Marton Balint
cus at passwd.hu
Fri Dec 6 21:48:43 CET 2013
On Fri, 6 Dec 2013, Paul B Mahol wrote:
> On 12/5/13, Husinsky Matthias <Matthias.Husinsky at fhstp.ac.at> wrote:
>> Hello,
>>
>> The histogram video filter behaves odd in waveform mode when using an
>> input file that has full range luma (yuvj420p).
>> Please check with this file (recorded by a Canon 5DmII):
>> http://www.datafilehost.com/d/acd54299
>>
>> When applying the histogram filter as follows the histogram is fine (luma
>> values streched from 0-255)
>>
>> ---
>> mhusinsky$ ffplay -vf histogram fullrange_y.mp4
>> ffplay version 2.1.git-65f41b5 Copyright (c) 2003-2013 the FFmpeg
>> developers
>> built on Dec 3 2013 21:42:13 with Apple LLVM version 5.0
>> (clang-500.2.79) (based on LLVM 3.3svn)
>> configuration: --prefix=/opt/local --enable-swscale --enable-avfilter
>> --enable-avresample --enable-libmp3lame --enable-libvorbis
>> --enable-libopus --enable-libtheora --enable-libschroedinger
>> --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex
>> --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype
>> --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man
>> --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64
>> --enable-yasm --enable-gpl --enable-postproc --enable-libx264
>> --enable-libxvid --enable-version3 --enable-libopencore-amrnb
>> --enable-libopencore-amrwb --enable-nonfree --enable-libfaac
>> libavutil 52. 56.100 / 52. 56.100
>> libavcodec 55. 44.100 / 55. 44.100
>> libavformat 55. 21.102 / 55. 21.102
>> libavdevice 55. 5.102 / 55. 5.102
>> libavfilter 3. 91.100 / 3. 91.100
>> libavresample 1. 1. 0 / 1. 1. 0
>> libswscale 2. 5.101 / 2. 5.101
>> libswresample 0. 17.104 / 0. 17.104
>> libpostproc 52. 3.100 / 52. 3.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fullrange_y.mp4':B f=0/0
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf55.21.102
>> Duration: 00:00:02.00, start: 0.000000, bitrate: 37435 kb/s
>> Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
>> 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 37431 kb/s, 30 fps, 30
>> tbr, 12k tbn, 24k tbc (default)
>> Metadata:
>> handler_name : VideoHandler
>> [swscaler @ 0x7f8857004e00] deprecated pixel format used, make sure you
>> did set range correctly
>> [swscaler @ 0x7f8857040600] deprecated pixel format used, make sure you
>> did set range correctly
>> 2.45 M-V: -0.028 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
>> ---
>>
>> When using the waveform mode the values are compressed into broadcast
>> range and waveform output of luma does not reflect the actual content
>> (clearly visible with the regular spikes shown as "lines" at regular
>> intervals in the luma spectrum):
>>
>> ---
>> mhusinsky$ ffplay -color_range 2 -vf
>> histogram=mode=waveform:waveform_mode=column:waveform_mirror=1
>> fullrange_y.mp4
>> ffplay version 2.1.git-65f41b5 Copyright (c) 2003-2013 the FFmpeg
>> developers
>> built on Dec 3 2013 21:42:13 with Apple LLVM version 5.0
>> (clang-500.2.79) (based on LLVM 3.3svn)
>> configuration: --prefix=/opt/local --enable-swscale --enable-avfilter
>> --enable-avresample --enable-libmp3lame --enable-libvorbis
>> --enable-libopus --enable-libtheora --enable-libschroedinger
>> --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex
>> --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype
>> --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man
>> --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64
>> --enable-yasm --enable-gpl --enable-postproc --enable-libx264
>> --enable-libxvid --enable-version3 --enable-libopencore-amrnb
>> --enable-libopencore-amrwb --enable-nonfree --enable-libfaac
>> libavutil 52. 56.100 / 52. 56.100
>> libavcodec 55. 44.100 / 55. 44.100
>> libavformat 55. 21.102 / 55. 21.102
>> libavdevice 55. 5.102 / 55. 5.102
>> libavfilter 3. 91.100 / 3. 91.100
>> libavresample 1. 1. 0 / 1. 1. 0
>> libswscale 2. 5.101 / 2. 5.101
>> libswresample 0. 17.104 / 0. 17.104
>> libpostproc 52. 3.100 / 52. 3.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fullrange_y.mp4':B f=0/0
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf55.21.102
>> Duration: 00:00:02.00, start: 0.000000, bitrate: 37435 kb/s
>> Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
>> 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 37431 kb/s, 30 fps, 30
>> tbr, 12k tbn, 24k tbc (default)
>> Metadata:
>> handler_name : VideoHandler
>> [swscaler @ 0x7f80fd11f400] deprecated pixel format used, make sure you
>> did set range correctly
>> 1.62 M-V: -0.001 fd= 1 aq= 0KB vq= 163KB sq= 0B f=0/0
>>
>> ---
>>
>>
>>
>> Trying to force a certain format like this does not improve the situation:
>> ffplay -color_range 2 -vf
>> format=pix_fmts=yuvj420p,histogram=mode=waveform:waveform_mode=column:wavef
>> orm_mirror=1 fullrange_y.mp4
>>
>>
>>
>> I found that applying the filter in ffmpeg and piping the output to ffplay
>> actually works as intended.
>>
>> ---
>> mhusinsky$ ffmpeg -i fullrange_y.mp4 -vf
>> histogram=mode=waveform:waveform_mode=column:waveform_mirror=1 -c:v
>> rawvideo -f nut - |ffplay -
>> ffmpeg version 2.1.git-65f41b5 Copyright (c) 2000-2013 the FFmpeg
>> developers
>> built on Dec 3 2013 21:42:13 with Apple LLVM version 5.0
>> (clang-500.2.79) (based on LLVM 3.3svn)
>> configuration: --prefix=/opt/local --enable-swscale --enable-avfilter
>> --enable-avresample --enable-libmp3lame --enable-libvorbis
>> --enable-libopus --enable-libtheora --enable-libschroedinger
>> --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex
>> --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype
>> --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man
>> --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64
>> --enable-yasm --enable-gpl --enable-postproc --enable-libx264
>> --enable-libxvid --enable-version3 --enable-libopencore-amrnb
>> --enable-libopencore-amrwb --enable-nonfree --enable-libfaac
>> libavutil 52. 56.100 / 52. 56.100
>> libavcodec 55. 44.100 / 55. 44.100
>> libavformat 55. 21.102 / 55. 21.102
>> libavdevice 55. 5.102 / 55. 5.102
>> libavfilter 3. 91.100 / 3. 91.100
>> libavresample 1. 1. 0 / 1. 1. 0
>> libswscale 2. 5.101 / 2. 5.101
>> libswresample 0. 17.104 / 0. 17.104
>> libpostproc 52. 3.100 / 52. 3.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fullrange_y.mp4':
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf55.21.102
>> Duration: 00:00:02.00, start: 0.000000, bitrate: 37435 kb/s
>> Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
>> 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 37431 kb/s, 30 fps, 30
>> tbr, 12k tbn, 24k tbc (default)
>> Metadata:
>> handler_name : VideoHandler
>> Output #0, nut, to 'pipe:':
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf55.21.102
>> Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuvj420p, 1920x768
>> [SAR 1:1 DAR 5:2], q=2-31, 200 kb/s, 61440 tbn, 30 tbc (default)
>> Metadata:
>> X-Language : eng
>> handler_name : VideoHandler
>> Stream mapping:
>> Stream #0:0 -> #0:0 (h264 -> rawvideo)
>> Press [q] to stop, [?] for help
>> ffplay version 2.1.git-65f41b5 Copyright (c) 2003-2013 the FFmpeg
>> developers
>> built on Dec 3 2013 21:42:13 with Apple LLVM version 5.0
>> (clang-500.2.79) (based on LLVM 3.3svn)
>> configuration: --prefix=/opt/local --enable-swscale --enable-avfilter
>> --enable-avresample --enable-libmp3lame --enable-libvorbis
>> --enable-libopus --enable-libtheora --enable-libschroedinger
>> --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex
>> --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype
>> --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man
>> --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64
>> --enable-yasm --enable-gpl --enable-postproc --enable-libx264
>> --enable-libxvid --enable-version3 --enable-libopencore-amrnb
>> --enable-libopencore-amrwb --enable-nonfree --enable-libfaac
>> libavutil 52. 56.100 / 52. 56.100
>> libavcodec 55. 44.100 / 55. 44.100
>> libavformat 55. 21.102 / 55. 21.102
>> libavdevice 55. 5.102 / 55. 5.102
>> libavfilter 3. 91.100 / 3. 91.100
>> libavresample 1. 1. 0 / 1. 1. 0
>> libswscale 2. 5.101 / 2. 5.101
>> libswresample 0. 17.104 / 0. 17.104
>> libpostproc 52. 3.100 / 52. 3.100
>> Input #0, nut, from 'pipe:':aq= 0KB vq= 0KB sq= 0B f=0/0
>> Metadata:
>> major_brand : isom
>> minor_version : 512
>> compatible_brands: isomiso2avc1mp41
>> encoder : Lavf55.21.102
>> Duration: N/A, start: 0.000000, bitrate: N/A
>> Stream #0:0(eng): Video: rawvideo (I420 / 0x30323449), yuv420p,
>> 1920x768, SAR 1:1 DAR 5:2, 30 fps, 30 tbr, 61440 tbn, 61440 tbc (default)
>> Metadata:
>> handler_name : VideoHandler
>> frame= 60 fps= 33 q=0.0 Lsize= 129602kB time=00:00:02.00
>> bitrate=530851.7kbits/s
>> video:129600kB audio:0kB subtitle:0 global headers:0kB muxing overhead
>> 0.001901%
>> 3.02 M-V: -0.033 fd= 4 aq= 0KB vq= 0KB sq= 0B f=0/0
>> ---
>>
>>
>> Now is there any possibility to achieve this behaviour in ffplay directly
>> (i.e. by not piping outputs)? I find it confusing that the levels and
>> waveform mode behave differently in ffplay.
The trick is to force the format at the end of the filter chain, this way
to yuvj420 -> yuv420 conversion will only take place in the very end,
after the histogram has been calculated.
> Because ffplay somehow somewhere (in middle of filtergraph) inserts
> another format
> filter and output to something unexpected.
>
Actually ffplay sets up the filter graph only with yuvj420 input and
yuv420 output, and avfilter auto inserts the format conversion scaler
somewhere in the graph. (In your case, into the beginning of the
chain rather than into the end).
I'm asking the others, is this intentional/documented behaviour of
avfilter? is there a way to specify it to only do it in the
end of the filter chain? Because if there is a way to ensure this,
probably that is what the users would want, so I'm more than happy to
change ffplay to work like that.
>> Am I doing something wrong or is this a bug of ffplay? I^1m using the
>> histogram mainly for inspection purposes and would prefer doing it
>> directly in ffplay.
>
> ffplay is a toy. You should use something that can use better graphic
> output than SDL.
>
>>
>> Thank you,
>> Matthias
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
Regards,
Marton
More information about the ffmpeg-user
mailing list