Audio-In-Video-Detector AIVD

January 19, 2024 · View on GitHub

Developed by Davis_Software © 2024

GitHub release (latest by date) GitHub issues GitHub closed issues GitHub all releases GitHub

What is AIVD?

AIVD or Audio-In-Video-Detector finds a specified audio file in the audio track of video files and returns the audio offset.

Thus, it can for example be used to find the intro of a tv show in its episodes.

Requirements

  • currently works on linux only
  • python3.5 - python3.7 only (scipy)
  • ffmpeg is required
  • development requirements can be installed with pip3 install -r requirements.txt

Usage

    aivd [OPTIONS] INPUT_FILE DIRECTORY

        Find the INPUT_FILE audio file in the specified video or audio files in a
        folder and return the time index.
        
        INPUT_FILE: The audio file to search for.
        DIRECTORY: The directory with the video or audio files to search in.
OptionData TypeDescriptionDefault
-r, --recursiveflagSearch recursively in the specified directory.
-e, --extensionstringThe extension of the video/audio files to search in. Can be a comma separated list."mp4,mkv,avi,mov,wmv,mp3,wav,flac,ogg,m4a,wma"
-x, --excludestringExclude the specified extension from the search. Can be a comma separated list.""
-t, --timeintegerHow many seconds of the input audio file to search for.-1 (meaning the entire file)
-w, --windowintegerThe window size in seconds to search for the audio file.60
-f, --formatjson | txt | rawThe output format."txt"
-c, --threadsintegerThe number of CPU threads to use.half of system cpu threads
--ffmpegstringThe path to the ffmpeg executable.from system path
--ffmpeg-processesintegerThe number of ffmpeg processes to run at the same time.1
--ffmpeg-argsstringAdditional arguments to pass to ffmpeg. Best pass them in quotes.None
--no-cleanflagDo not clean up temporary files.
--silentflagDo not print anything but the final output to the console.
--debugflagPrint debug information to the console.
--dry-runflagDo not run the program, just print the parameters.
--versionflagPrint the version number and exit.
--legacyflagUse the legacy cli.
--helpflagShow help message and exit.

Legacy CLI

    aivd --legacy [-h] --find-offset-of <audio file> [--within <folder>]
            [--extension <file extension>] [--recursive <boolean>]
            [--extension-skip <file extension>] [--window <seconds>]
            [--log-level <level>] [--raw <boolean>] [--ffmpeg <path>]
OptionTypeDescriptionDefaultRequired
--legacyflagNeeded to use the legacy cliyes
-h or --helpflagDisplay the help dialogno
--find-offset-of <audio file>stringAudio file to search foryes
--within <folder>stringFolder path with video files to search in"."no
--recursive <boolean>booleanRecursively traverse specified folderfalseno
--extension <ile extension>stringOnly search in the files with this extension"*"no
--extension-skip <ile extension>stringSkip the files with this extension""no
--window <seconds>integerOnly search in the first n seconds of the files60no
--log-level <log level>stringSet the applications log level"info"no
--raw <boolean>booleanSet raw output (as JSON)falseno
--ffmpeg <path>stringPath to a custom ffmpeg installation"/usr/bin/ffmpeg"no

Compilation

You can use pyinstaller to generate a binary in ./dist/

    pyinstaller aivd.spec