class_docstr: Implement FFmpeg wrapper for video compression defence based on H.264/MPEG-4 AVC.
  
  Video compression uses H.264 video encoding. The video quality is controlled with the constant rate factor
  parameter. More information on the constant rate factor: https://trac.ffmpeg.org/wiki/Encode/H.264.
class_docstr_tok: ["Implement","FFmpeg","wrapper","for","video","compression","defence","based","on","H.264\/MPEG-4","AVC",".","Video","compression","uses","H.264","video","encoding",".","The","video","quality","is","controlled","with","the","constant","rate","factor","parameter",".","More","information","on","the","constant","rate","factor",":","https",":","\/\/trac.ffmpeg.org\/wiki\/Encode\/H.264","."]
docstr: Create an instance of VideoCompression.
  
  :param video_format: Specify one of supported video file extensions, e.g. `avi`, `mp4` or `mkv`.
  :param constant_rate_factor: Specify constant rate factor (range 0 to 51, where 0 is lossless).
  :param channels_first: Set channels first or last.
  :param apply_fit: True if applied during fitting/training.
  :param apply_predict: True if applied during predicting.
  :param verbose: Show progress bars.
docstr_tok: ["Create","an","instance","of","VideoCompression",".",":","param","video_format",":","Specify","one","of","supported","video","file","extensions",",","e.g",".","`","avi","`",",","`","mp4","`","or","`","mkv","`",".",":","param","constant_rate_factor",":","Specify","constant","rate","factor","(","range","0","to","51",",","where","0","is","lossless",")",".",":","param","channels_first",":","Set","channels","first","or","last",".",":","param","apply_fit",":","True","if","applied","during","fitting\/training",".",":","param","apply_predict",":","True","if","applied","during","predicting",".",":","param","verbose",":","Show","progress","bars","."]
code: def __init__(
      self,
      *,
      video_format: str,
      constant_rate_factor: int = 28,
      channels_first: bool = False,
      apply_fit: bool = False,
      apply_predict: bool = True,
      verbose: bool = False,
  ):
      """
      Create an instance of VideoCompression.
  
      :param video_format: Specify one of supported video file extensions, e.g. `avi`, `mp4` or `mkv`.
      :param constant_rate_factor: Specify constant rate factor (range 0 to 51, where 0 is lossless).
      :param channels_first: Set channels first or last.
      :param apply_fit: True if applied during fitting/training.
      :param apply_predict: True if applied during predicting.
      :param verbose: Show progress bars.
      """
      super().__init__(
          is_fitted=True,
          apply_fit=apply_fit,
          apply_predict=apply_predict,
      )
      self.video_format = video_format
      self.constant_rate_factor = constant_rate_factor
      self.channels_first = channels_first
      self.verbose = verbose
      self._check_params()
  
file_path: adversarial-robustness-toolbox/art/defences/preprocessor/video_compression.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  from tempfile import TemporaryDirectory
  from typing import Optional, Tuple
  import warnings
  import numpy
  from tqdm.auto import tqdm
  from art import config
  from art.defences.preprocessor.preprocessor import Preprocessor
label_desc: Use image node_id 1 to create a new VideoCompression object from inherited base classes: Preprocessor with example: obj = VideoCompression()