[FFmpeg-user] filterstats broadcast legal report

Carles Vila cvilad at gmail.com
Thu Feb 12 23:11:20 CET 2015


On 12 February 2015 at 02:17, Dave Rice <dave at dericed.com> wrote:

> Hi Carles,
>
> > On Feb 11, 2015, at 1:45 PM, Carles Vila <cvilad at gmail.com> wrote:
> >
> > Hi all,
> > I'd like to set up a command to find out if a video is broadcast legal.
> > I've tried to understand how signalstats works but I need some help.
> > I tried the examples in the ffmpeg filter documentation, like the one
> > pasted below, but I'd like to customize it to my needs.
> >
> > Ideally It would output a list of frames that do not meet broadcast
> specs.
> >
> > FWIW, the video is Quicktime wrapped DNxHD.
> > Thank you!
> >
> >
> > $ ffprobe -f lavfi movie=INPUTFILE.mov,signalstats="stat=brng"
> -show_frames
> > ffprobe version 2.4.2 Copyright (c) 2007-2014 the FFmpeg developers
> >  built on Oct 28 2014 17:39:46 with Apple LLVM version 5.1
> > (clang-503.0.40) (based on LLVM 3.4svn)
> >  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.2 --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-libfreetype
> > --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp
> > --enable-libopencore-amrnb --enable-libopencore-amrwb
> --enable-libvo-aacenc
> > --enable-libass --enable-ffplay --enable-libspeex
> --enable-libschroedinger
> > --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg
> >
> --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 '
> >  libavutil      54.  7.100 / 54.  7.100
> >  libavcodec     56.  1.100 / 56.  1.100
> >  libavformat    56.  4.101 / 56.  4.101
> >  libavdevice    56.  0.100 / 56.  0.100
> >  libavfilter     5.  1.100 /  5.  1.100
> >  libavresample   2.  1.  0 /  2.  1.  0
> >  libswscale      3.  0.100 /  3.  0.100
> >  libswresample   1.  1.100 /  1.  1.100
> >  libpostproc    53.  0.100 / 53.  0.100
> > Input #0, lavfi, from 'movie=INPUTFILE.mov,signalstats=stat=brng':
> >  Duration: N/A, start: 0.000000, bitrate: N/A
> >    Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 1920x1080
> > [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
> > [FRAME]
> > media_type=video
> > key_frame=1
> > pkt_pts=0
> > pkt_pts_time=0.000000
> > pkt_dts=0
> > pkt_dts_time=0.000000
> > best_effort_timestamp=0
> > best_effort_timestamp_time=0.000000
> > pkt_duration=1
> > pkt_duration_time=0.040000
> > pkt_pos=577024
> > pkt_size=4147200
> > width=1920
> > height=1080
> > pix_fmt=yuv422p
> > sample_aspect_ratio=1:1
> > pict_type=I
> > coded_picture_number=0
> > display_picture_number=0
> > interlaced_frame=0
> > top_field_first=0
> > repeat_pict=0
> > TAG:lavfi.signalstats.YMIN=12
> > TAG:lavfi.signalstats.YLOW=58
> > TAG:lavfi.signalstats.YAVG=74.9742
> > TAG:lavfi.signalstats.YHIGH=84
> > TAG:lavfi.signalstats.YMAX=241
> > TAG:lavfi.signalstats.UMIN=36
> > TAG:lavfi.signalstats.ULOW=145
> > TAG:lavfi.signalstats.UAVG=150.074
> > TAG:lavfi.signalstats.UHIGH=158
> > TAG:lavfi.signalstats.UMAX=166
> > TAG:lavfi.signalstats.VMIN=47
> > TAG:lavfi.signalstats.VLOW=98
> > TAG:lavfi.signalstats.VAVG=106.101
> > TAG:lavfi.signalstats.VHIGH=112
> > TAG:lavfi.signalstats.VMAX=174
> > TAG:lavfi.signalstats.SATMIN=0
> > TAG:lavfi.signalstats.SATLOW=24
> > TAG:lavfi.signalstats.SATAVG=32.6906
> > TAG:lavfi.signalstats.SATHIGH=42
> > TAG:lavfi.signalstats.SATMAX=99
> > TAG:lavfi.signalstats.HUEMED=313
> > TAG:lavfi.signalstats.HUEAVG=308.107
> > TAG:lavfi.signalstats.YDIF=0
> > TAG:lavfi.signalstats.UDIF=0
> > TAG:lavfi.signalstats.VDIF=0
> > TAG:lavfi.signalstats.BRNG=0.00231144
> > [/FRAME]
>
> This means that 0.00231144% of the frame is outside of broadcast range (Y
> within 16-235 and U/V within 16-240) which in your file is about 4,793
> pixels. I vaguely remember someone referring a broadcast standards
> document  which referred to broadcast legal not considering 100% of pixels
> to be within that range, but considered broadcast legal to mean somewhat
> less than 100% of the pixels had to be in the stated ranges. Unfortunately
> I can't remember what amount of outliers was tolerated or what the spec was.
>
> The output of
> ffprobe -f lavfi movie=INPUTFILE.mov,signalstats="stat=brng" -show_entries
> frame_tags=lavfi.signalstats.BRNG -of flat
>
> may be easier to parse in your scenario since the output will include the
> frame numbers, like
>
> frames.frame.567.tags.lavfi_signalstats_BRNG="0"
> frames.frame.568.tags.lavfi_signalstats_BRNG="0"
> frames.frame.569.tags.lavfi_signalstats_BRNG="0"
>
> then you would need to grep out the lines where BRNG exceed some defined
> threshold. Hope this helps.
> Dave Rice
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


Hi Dave, thanks so much for the explanation and the command. I look forward
to test it out.

I found this document:
http://www.bbc.co.uk/guidelines/dq/pdf/tv/TechnicalDeliveryStandardsBBCv3.pdf

where it states:

2.3.2 Tolerance of out of gamut signals

In practice it is difficult to avoid generating signals slightly outside
this range, and it is considered reasonable to allow a small tolerance,
which has been defined as follows under EBU Rec103:

  RGB components must be between -5 % and 105% (-35 and 735mV) and

  Luminance (Y) must be between -1% and 103% (-7mV and 721mV)

Slight transient overshoots and undershoots may be filtered out before
measuring, and an error will only be registered where the out of gamut
signals total at least 1% of picture area. Many monitoring devices are
designed to detect errors to this specification.

   -


More information about the ffmpeg-user mailing list