GithubHelp home page GithubHelp logo

scuti-harry-hoang / lafontaine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from umutseven92/lafontaine

0.0 0.0 0.0 59.35 MB

An automatic movie trailer generator.

License: MIT License

Python 100.00%

lafontaine's Introduction

LaFontaine Build Status Codacy Badge

LaFontaine is an automatic movie trailer generator.

Description

LaFontaine creates movie trailers for any genre using pre-defined features, like number of faces on screen, and loudness of volume. Scenes are extracted using these features and combined to create the final trailer. There are three features for frame, three features for sound and three features for subtitles. Features are read from configurations and are fully configurable.

Etymology

LaFontaine is named after the legendary Don LaFontaine, who was the voice of more than 5000 movie trailers. He is the voice in the classic phrase "In a world...".

All Features

Image Features

Face Recognizer

{
  "id": "FaceRecognizer",
  "face_count": 3,
  "frames": 100
}

Records for frames amount of frames if the amount of faces in the screen is greater than face_count.

Frame Delta Detector

{
  "id": "FrameDeltaDetector",
  "delta": 0.95,
  "frame_limit": 50,
  "scene_change_limit": 3,
  "frames": 75
}

Records for frames amount of frames if frame difference percentage is greater than delta at least scene_change_limit times continuously for at least frame_limit frames.

Frame Color Counter

{
  "id": "ColorCounter",
  "color_count": 50000,
  "frames": 100
}

Records for frames amount of frames if the amount of unique colors is greater than color_count.

Sound Features

Sound Peak Detector

{
  "id": "SoundPeakDetector",
  "audio_threshold": 0.30,
  "frames": 50
}

Records for frames amount of frames if the volume is higher than audio_threshold.

High Volume Detector

{
  "id": "HighVolumeDetector",
  "volume": 0.60,
  "frame_limit": 50,
  "frames": 70
}

Records for frames amount of frames if the volume is continuously higher than volume for frame_limit amount of frames.

Sound Delta Detector

{
  "id": "SoundDeltaDetector",
  "delta": 3,
  "frame_limit": 50,
  "scene_change_limit": 3,
  "frames": 75
}

Records for frames amount of frames if audio difference percentage is greater than delta at least scene_change_limit times continuously for at least frame_limit frames.

Subtitle Features

Subtitle Density Detector

{
  "id": "SubtitleDensityDetector",
  "char_count": 60,
  "frames": 100
}

Records for frames amount of frames if the subtitle has more than char_count characters.

Subtitle Intensity Detector

{
  "id": "SubtitleIntensityDetector",
  "intensity_char": "!",
  "char_count": 3,
  "frames": 100
}

Records for frames amount of frames if the subtitle has more than char_count intensity_char characters.

Subtitle Conversation Counter

{
  "id": "SubtitleConversationCount",
  "conversation_count": 2,
  "frames": 100
}

Records for frames amount of frames if the subtitle has more than conversation_count characters speaking.

Dependencies

  • Python 3+.
  • ImageMagick is required to create end titles.
  • If CUDA is going to be enabled for better performance, dlib needs to be compiled with CUDA support.

Configuration

Configuration files contain list of features and some other metadata. Each genre has its own configuration file. To create an action movie trailer, you use the action.lf file, to create a comedy movie trailer you use comedy.lf and vice versa.

Example configuration files are given in the res/config/ folder, however you can create your own custom configurations.

res/config/action.lf:

{
  "genre": "action",
  "max_length": "120",
  "features": [
    {
      "id": "SoundPeakDetector",
      "audio_threshold": 0.30,
      "frames": 50
    },
    {
      "id": "FrameDeltaDetector",
      "delta": 0.95,
      "frame_limit": 50,
      "scene_change_limit": 3,
      "frames": 75
    },
    {
      "id": "HighVolumeDetector",
      "volume": 0.60,
      "frame_limit": 50,
      "frames": 70
    },
    {
      "id": "FaceRecognizer",
      "face_count": 3,
      "frames": 100
    },
    {
      "id": "SubtitleIntensityDetector",
      "intensity_char": "!",
      "char_count": 3,
      "frames": 100
    }
  ]
}
Parameter Description Required
genre Name of the genre True
max_length Max length of the trailer in seconds True
features List of features, listed in order of importance True

Usage

python lafontaine.py -f res/videos/northbynorthwest.mp4 -s res/subtitles/northbynorthwest.srt -c res/config/action.lf -t "North by Northwest" -d 480 -cd
Parameter Description Required
-f, --file Path to the video file True
-s, --sub Path to the subtitle file1 False
-o, --output Path to the output file2 False
-c, --config Path to the feature configuration file True
-t, --title What to put on the title card in the end of the trailer False
-d, --downscale Which width to downscale the resolution to3 False
-cd, --cuda Enable CUDA support False
-sp, --spoiler Parse only the first half of the movie to avoid spoilers False

1: If this option is not given, subtitle features will be disabled.

2: If this option is not given, the output will be saved to lafontaine/out/.

3: Aspect ration will be preserved.

Example Trailer

lafontaine's People

Contributors

codacy-badger avatar umutseven92 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.