Skip to content

mediaexmachina/mediadeepa

Repository files navigation

Media Deep Analysis

Audio/video medias and streams deep analyzer in Java with FFmpeg as back-end: extract/process technical information from audio/videos files/streams.

This application is currently in alpha version, and should not be ready for production

🚩 About
🏪 Features
⚡ Getting started
🛫 Examples
📕 Documentation, contributing and support
🌹 Acknowledgments

CodeQL Java CI with Maven Quality Gate Status

🚩 About

This application will run FFmpeg on a source video/audio file to apply some filters, and generate analysis raw data (mostly high verbosely text/XML streams). They are parsed and reduced/converted/drawn/summarized them to some output formats by Mediadeepa.

Mediadeepa is a command line standalone application (no GUI, no specific setup).

This application is licensed with the GNU General Public License v3.

🏪 Features

Mediadeepa can handle any audio/video files managed by FFmpeg, and produce reports with it.

Analysis scope is currently based on FFmpeg filters and tools:

  • Audio phase meter aphasemeter
  • Time domain statistics about audio frames astats
  • Audio loudness meter (EBU R128 scanner) ebur128
  • Audio silence detection silencedetect
  • Video black/block artifacts/blurred/duplicate/interlacing frames detection (blackdetect / blockdetect / blurdetect / freezedetect / idet)
  • Video border detection cropdetect
  • Video spatial information (SI) and temporal information (TI) siti
  • Structural media container information: audio/video stream frames size, timing, GOP type
  • Create a technical resumed of media file based on FFprobe media file header
  • Optional filter use, based on command line (user choice) and current FFmpeg filter availability on app environment.
  • User can optionally add timed constraints:
    • start position on media file
    • limit analysis duration on media file
    • limit time to do the analysis operation
  • During the analyzing operation, an ETA/progress bar is displayed, and based on current FFmpeg processing

And it can export to file the FFprobe XML with media headers (container and A/V streams).

This application can run on three different "modes":

  • Process to export: this is the classical mode. Mediadeepa will drive FFmpeg to produce analysis data from your source file, and export the result a the end.
  • Process to extract: sometimes, you don't need to process data during the analysis session. So, Mediadeepa can just extract to raw text/xml files (zipped in one archive file) all the gathered data from FFmpeg.
  • Import to export: to load in Mediadeepa all gathered raw data files. Mediadeepa is very tolerant with the zip content, notably if they were not created by Mediadeepa (originally). No one is mandatory in zip.

You can process multiple files in one run, as well as load a text file as file list to process.

Known limitations for Mediadeepa

  • It only support the first video, and the first founded audio stream of a file.
  • Audio mono and stereo only.
  • Some process take (long) time to do, like SITI and container analyzing, caused by poor FFmpeg/FFprobe performances with these filters.
  • Loudness EBU R-128 measure works correctly with FFmpeg v7+, due to internal bugs/limitations with the previous versions.

An internal warning will by displayed if you try to works with a Zip archive created by a different Mediadeepa version.

⚡ Getting started

Dependencies needed for run Mediadeepa

  • Java/JRE/JDK 17+
  • FFmpeg/FFprobe v5+ (v7+ highly recommended)

Declared on OS (Windows/Linux/macOS) PATH.

Get Linux application packages

Download the last application release, as a Linux RPM or DEB package, or as an executable JAR (autonomous fat JAR file), downloaded directly from GitHub releases page, and build at each releases.

Install/update with

# DEB file on Debian/Ubuntu Linux distribs
sudo dpkg -i mediadeepa-0.0.32.deb

# RPM file on RHEL/CentOS Linux distribs
sudo rpm -U mediadeepa-0.0.32.rpm

Remove with sudo dpkg -r mediadeepa or rpm -e mediadeepa.

After, on Linux, run mediadeepa [parameters], and man mediadeepa for the internal doc man page.

Run simple JAR file

On Windows/macOS, just run java -jar mediadeepa-0.0.32.jar [options].

And simply run the application with java -jar mediadeepa-0.0.32.jar.

Mediadeepa contain embedded help, displayed with the -h parameter.

You can set the command line parameters with java -jar mediadeepa-0.0.32.jar [parameters].

Make a Java executable JAR file

You can build yourself a JAR, with Git and Maven.

Run on Linux/WSL/macOS, after setup Git and Maven:

git clone https://github.com/mediaexmachina/mediadeepa.git
cd mediadeepa
mvn install -DskipTests

Build jar will be founded on target directory as mediadeepa-0.0.32.jar

🛫 Examples

Process to export

Export to the current directory the analysis report for the file videofile.mov:

mediadeepa -i videofile.mov -f report -e .

Export to my Download directory the analysis result, as MS Excel and graphic files, the media file videofile.mov, only for audio and media container:

mediadeepa -i videofile.mov -c -f xlsx -f graphic -vn -e $HOME/Downloads

All available Export formats type are listed by:

mediadeepa -o

Import or Process to extract

Just:

mediadeepa -i videofile.mov --extract analysing-archive.zip

You can setup FFmpeg, like with import, like:

mediadeepa -i videofile.mov -c -an --extract analysing-archive.zip

Extracted (archive) ZIP file can be loaded simply by -i:

mediadeepa -i analysing-archive.zip -f report -f graphic -e .

Multiple Import or Process

Add -i options to works with multiple files, like:

mediadeepa -i analysing-archive.zip -i videofile.mov -i anotherfile.wav -f report -f graphic -e .

You can mix archive zip files and media files, but beware to not import with extract (zip to zip) or use single output file mode (--single-export).

Load files to process from a text file

With the -il, as input list option:

mediadeepa -if my-medias.txt -f report -f graphic -e .

And the my-medias.txt file can just contain:

analysing-archive.zip
videofile.mov
anotherfile.wav
  • Any space lines are ignored.
  • Charset load respect the current OS session.
  • You can use Windows and Linux new lines symbols (and you can mix them).
  • You can accumulate multiple -i and -il options, with the same limits as Multiple Import or Process.
  • Before starts the imports and processing, the application will check and throw an error if a file is missing (in -i, -il, and in the lists itself).

You can read the FFmpeg filter documentation to know the behavior for each used filters, and the kind of returned values.

The project website contain the full documentation regarding the internal variables to specify produced filenames, image sizes...

📕 Documentation, contributing and support

You can found some documentation:

Send bug reports on GitHub project page

  • Help with the documentation.
  • Propose pull requests.
  • Or just take time to test the application and report the experience.

If you have any questions, feel free to reach out via any contact method listed on https://mexm.media.

End-to-end automatic tests

In the project source repository, you will found some tools to end-to-ends (e2e) automatic tests, in order to check the application behavior with real video files.

These tests are optional during the run of classical automatic tests, and only concerns dev. operations.

To run classical automatic tests, just run a mvn test.

To run e2e tests, you will need ffmpeg and bash:

  • Create video tests files on .demo-media-files with bash create-demo-files.bash (approx 230MB).
  • Optionally run bash create-long-demo-file.bash to create a big test video file.
  • Next, just run mvn test.

E2e tests take time. They will produce temp files in target directory (e2e* directories). A simple mvn clean wipe them, else the e2e scripts can reuse old generated files and don't loose some time.

E2e tests deeply checks all produced data from the application.

Releases

On each git tag, a GitHub Action will make a DEB and a RPM package on GitHub releases.

This Action use linux-springboot-packager to generate this files. Free feel to read this project documentation.

These packages are provided "as-it", as same for Mediadeepa. They are not signed.

🌹 Acknowledgments

Mediadeepa would never have been possible without the help of these magnificent and amazing OSS projects:

And the tech stack:

  • Java 17
  • Spring Boot 3
  • Picocli 4
  • My prodlib and medialib utility libs.
  • Maven (see pom.xml for more information)
  • Open CSV
  • Apache POI (poi-ooxml)
  • SQLite JDBC
  • Jackson
  • jFreechart
  • j2html

See THIRD-PARTY.txt file for more information on licenses and the full tech stack.