Skip to content

transcode:cropdetect

transcode:cropdetect

Automatic video frame cropping detection based on ffmpeg commandline

Full documentation of the tool`s crop detection can be found here: ffmpeg - cropdetect

This implementation covers accurate detection of black bars across entire movies, with predefined parameters. The output output will be stored as environment variable "cropdetect" which can be used for cropping instructions in subsequent ffmpeg commands.

Example:

{
  "parameters": {
    "inputfile": "movie.mov"
  },
  "tool": "transcode:cropdetect"
},

Returns frame dimensions without black bars, width:height:columns_indent:rows_indent, for example:

crop=1920:1072:0:4

Example for cropping instructions with that output in a later ffmpeg command:

{
  "tool": "ffmpeg:cmd",
  "parameters": {
    "ignore_decoding_errors": "false",
    "arguments": [
      "-i",
      "{input}",
      "-filter_complex", ""[0:v]{cropdetect}[cropped];[cropped]scale='(trunc((ih*((16/9)/2))*2))':ih,setsar=1[cropped]"",
      "-map", "[cropped]
      "-f",
      "mp4",
      "{output}"
    ]
  }
},
Parameter Properties Default Type Choice Description
inputfile required