[FFmpeg-user] Create a black box over top of the video for a set duration at a set time.

David Niklas deference at null.net
Sat Dec 31 04:45:07 EET 2022


On Sat, 24 Dec 2022 10:48:14 +0100
Bouke / Videotoolshed <bouke at videotoolshed.com> wrote:
> On 23 Dec 2022, at 22:55, David Niklas <deference at null.net> wrote:
> > 
> > Hello,
> > What I'd like to achieve is sort of like censoring, but with a black
> > box.
> > 
> > I can find plenty of examples of how to add a black box to a video,
> > but the problem is it is always either the whole video, or only at the
> > beginning/end, that the examples add black boxes  
> 
> 
> Try filter_complex "[0:0]youfilter=enable='between(t,1.0,2.0)’”
> 
<snip>

Sorry for taking so long to reply.
It is not working. Terminal output below.

% ffmpeg -i Ducksinarow.mp4 -filter_complex "[0:0]drawbox=color=black:t=fill=enable='between(t,1.0,2.0)'" -c:a copy -c:v libvpx ducks.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Ducksinarow.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: mp42iso2avc1mp41
    creation_time   : 2022-12-20T06:17:11.000000Z
  Duration: 00:00:12.54, start: 0.000000, bitrate: 2864 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/bt709/bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2759 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2022-12-20T06:17:11.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 129 kb/s (default)
    Metadata:
      creation_time   : 2022-12-20T06:17:11.000000Z
      handler_name    : Stereo
File 'ducks.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 (h264) -> drawbox
  drawbox -> Stream #0:0 (libvpx)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[Parsed_drawbox_0 @ 0x55fd8cb28640] [Eval @ 0x7fff13ad4a50] Invalid chars '=enable=between(t,1.0,2.0)' at the end of expression 'fill=enable=between(t,1.0,2.0)'
    Last message repeated 5 times
[Parsed_drawbox_0 @ 0x55fd8cb28640] Error when evaluating the expression 'fill=enable=between(t,1.0,2.0)'.
[Parsed_drawbox_0 @ 0x55fd8cb28640] Failed to configure input pad on Parsed_drawbox_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0

# // Now without single quotes, just in case.
% ffmpeg -i Ducksinarow.mp4 -filter_complex "[0:0]drawbox=color=black:t=fill=en
able=between(t,1.0,2.0)" -c:a copy -c:v libvpx ducks.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Ducksinarow.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: mp42iso2avc1mp41
    creation_time   : 2022-12-20T06:17:11.000000Z
  Duration: 00:00:12.54, start: 0.000000, bitrate: 2864 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/bt709/bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2759 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2022-12-20T06:17:11.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 129 kb/s (default)
    Metadata:
      creation_time   : 2022-12-20T06:17:11.000000Z
      handler_name    : Stereo
[AVFilterGraph @ 0x561ad3fff6c0] No such filter: '1.0'
Error initializing complex filters.
Invalid argument


More information about the ffmpeg-user mailing list