[FFmpeg-user] a -vf for broadcast safe

Dave Rice dave at dericed.com
Wed Dec 30 19:27:02 CET 2015


> On Dec 30, 2015, at 12:59 PM, Paul B Mahol <onemda at gmail.com> wrote:
> 
> On 12/30/15, Dave Rice <dave at dericed.com> wrote:
>> 
>>> On Feb 12, 2014, at 4:43 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>>> 
>>> Jim Shupert <jshupert <at> pps-inc.com> writes:
>>> 
>>>> input a unCompressed  yuv avi and get a second
>>>> Uncompressed yuv avi or mov and it would be
>>>> 'broadcast safe'.
>>> 
>>> Rereading your original post:
>>> Could you provide an uncompressed yuv avi that
>>> needs the filter you have in mind?
>>> (One frame is probably enough.)
>> 
>> Responding late, as I find myself in need of this filter as well.
>> 
>> A sample that needs the filter can be generated via:
>> 
>> ffmpeg -f lavfi -i color=gray:s=256x256 -vf
>> format=yuv444p,geq=lum=X,scale=out_range=tv -vframes 1 -pix_fmt yuv444p -c:v
>> rawvideo -y needsbroadcastsafe.nut
>> ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
>>  built with Apple LLVM version 7.0.2 (clang-700.1.81)
>>  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.4 --enable-shared
>> --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
>> --enable-avresample --cc=clang --host-cflags= --host-ldflags=
>> --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc
>> --enable-libxvid --enable-libfreetype --enable-libfaac --enable-libass
>> --enable-ffplay --enable-libopenjpeg --disable-decoder=jpeg2000
>> --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
>> --enable-nonfree --enable-vda
>>  libavutil      54. 31.100 / 54. 31.100
>>  libavcodec     56. 60.100 / 56. 60.100
>>  libavformat    56. 40.101 / 56. 40.101
>>  libavdevice    56.  4.100 / 56.  4.100
>>  libavfilter     5. 40.101 /  5. 40.101
>>  libavresample   2.  1.  0 /  2.  1.  0
>>  libswscale      3.  1.101 /  3.  1.101
>>  libswresample   1.  2.101 /  1.  2.101
>>  libpostproc    53.  3.100 / 53.  3.100
>> Input #0, lavfi, from 'color=gray:s=256x256':
>>  Duration: N/A, start: 0.000000, bitrate: N/A
>>    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 256x256 [SAR
>> 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
>> Output #0, nut, to 'needsbroadcastsafe.nut':
>>  Metadata:
>>    encoder         : Lavf56.40.101
>>    Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p, 256x256 [SAR
>> 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 51200 tbn, 25 tbc
>>    Metadata:
>>      encoder         : Lavc56.60.100 rawvideo
>> Stream mapping:
>>  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
>> Press [q] to stop, [?] for help
>> frame=    1 fps=0.0 q=-0.0 Lsize=     192kB time=00:00:00.04
>> bitrate=39382.2kbits/s
>> video:192kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
>> muxing overhead: 0.154114%
>> 
>> The result of `ffmpeg -i needsbroadcastsafe.nut -vf broadcastsafe
>> nowbroadcastsafe.nut` would result in the output containing luma values only
>> between 16-235 inclusively (8 bit) and 16-240 for chroma planes.
> 
> So what it would do? Rescale everything with fixed number, just clip,
> or some other
> fancy stuff?
> IMHO this is scale bug, does same happens with zscale?

I am unfamiliar with zscale. I ran  zscale=range=limited the output seems the same as the input.

ffmpeg -i needsbroadcastsafe.nut -vf zscale=range=limited -pix_fmt yuv444p -c:v rawvideo -y nowbroadcastzsafe.nut
ffmpeg version git-2015-12-30-2893dbf Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libfaac --enable-libass --enable-ffplay --enable-libzimg --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
  libavutil      55. 11.100 / 55. 11.100
  libavcodec     57. 20.100 / 57. 20.100
  libavformat    57. 21.100 / 57. 21.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 22.100 /  6. 22.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, nut, from 'needsbroadcastsafe.nut':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:00:00.36, start: 0.000000, bitrate: 43703 kb/s
    Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p, 256x256, SAR 1:1 DAR 1:1, 25 fps, 25 tbr, 51200 tbn, 51200 tbc
    Metadata:
      encoder         : Lavc56.60.100 rawvideo
Output #0, nut, to 'nowbroadcastzsafe.nut':
  Metadata:
    encoder         : Lavf57.21.100
    Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p, 256x256 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 51200 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.20.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=   10 fps=0.0 q=-0.0 Lsize=    1921kB time=00:00:00.40 bitrate=39333.5kbits/s speed= 165x    
video:1920kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030212%

Which zscale option would I use to create a broadcast safe output?

Dave Rice


More information about the ffmpeg-user mailing list