Giter Site home page Giter Site logo

jaedukseo / auto-mashup-mix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amamenko/auto-mashup-mix

0.0 1.0 0.0 1.01 MB

Music mashup and video creation with Node.js, FFMPEG, and Contentful

Home Page: https://automashup.ml

License: MIT License

JavaScript 94.46% CSS 4.35% HTML 1.19%

auto-mashup-mix's Introduction

MIT License LinkedIn


Auto Mashup (Mix Logic)

Music Mashup and Video Creation
with Node.js, FFMPEG, and Contentful

Website · YouTube Channel · Buy Me a Coffee · Instagram · Report Issue

Background

Auto Mashup creates music mashups automatically. It also automatically creates and uploads videos to its YouTube channel and each video's associated thumbnail to its Instagram page (@automaticmashup).

The Auto Mashup project is split into two repositories.

The first repository (https://github.com/amamenko/auto-mashup) handles the scraping of Billboard charts for song details and ranking information, as well as individual song data acquisition (e.g. tempo, key, mode, song structure and timestamps, beat positions, instrumental/vocal stems, etc.) using data from Spotify, Genius, YouTube, and other sources. This data is then stored in Contentful's Content Management System.

The second repository (the one you are visiting right now) is responsible for hosting the front-end code of Auto Mashup's official website, automashup.ml, using the data stored in Contentful to find mixable songs, creating those mashups, selecting non-blacklisted mashups and mixing them altogether, creating an associated video slideshow and uploading it to its YouTube channel, and uploading the associated video thumbnail to the @automaticmashup Instagram page.

Functionality



The basic functionality of this repository's code logic is:

Front-End Code:

Find Mixable Songs:

  • Search the Contentful CMS for songs that have the same mode (either major or minor).
  • Narrow down mashup song combinations to those that are within one semitone up or down, have an up to 5% difference in tempo, and in which the instrumental song has at least four continuous song sections that match the sections of the vocal song.
  • Remove mashup entries and associated audio assets if either one or both of the instrumental or vocal song entries have been deleted from Contentful due to not being found on any Billboard charts.

Create Mashups:

  • If both instrumental and vocal entries exist, both audio assets are downloaded from Contentful and mixed using fluent-ffmpeg. A complex filter is used to trim and delay the matching vocal sections to match the beats of the appropriate associated sections of the instrumental track.
  • The pitch and tempo of the vocal audio are manipulated using FFMPEG's rubberband feature to match the instrumental track using a predetermined key-scale and tempo-scale factor. This factor is also used to adjust the beat positions of the vocal track identified with essentia.js.
  • Audio inputs are normalized with FFMPEG's loudnorm filter to have similar audio volumes.
  • Vocal sections that are below a certain length threshold with respect to their associated instrumental section are looped.
  • Fades are added between each vocal section and between each loop.
  • The mixed MP3 mashup audio asset and entry containing data about the instrumental and vocal songs is stored in Contentful's CMS using the Content Management API. Additional information about the mix - such as vocal track mix start, mix end, and total duration - is also noted for use when mixing multiple mashups together.

Create Weekly Mix and Video of Selected Mashups:

  • Randomly selects either 20 vetted mashups or at least 28 minutes total worth of continuous vetted mashup mixes without any repeats.
  • In December, at least 5 holiday songs (instrumental, accompaniment, or both), if available, are included throughout the mashup mix.
  • Downloads each mashup's audio MP3 asset and each included song's cover photo from Contentful for use in both thumbnail creation and slideshow inclusion.
  • Creates a full audio MP3 mix with FFMPEG of all the selected mashups with a crossfade to transition between each mashup mix.
  • Creates a thumbnail JPEG image with dimensions 1280x720 using node-html-to-image. This thumbnail image has to be a JPEG in order to be able to be uploaded to Instagram via instagram-web-api. The thumbnail image contains the Auto Mashup logo and the most recent Billboard ranking week date superimposed onto a collage of eight randomly selected cover photos of songs featured in the current week's mashup mix.
  • Creates a slideshow image with dimensions 1280x720 (to ultimately create a 720p video) for each mashup with node-html-to-image. Each slideshow image contains each song's track title, artist, cover photo, latest Billboard chart positions, and key/tempo information.
  • Combines all the slideshow images with the full mashup audio mix using FFMPEG to show the appropriate slide image during the accompanying song's duration. Each slide is overlayed over and fades into the next slide.
  • Adds a green-screen "Like and Subscribe" overlay banner at the beginning of each video and a green-screen "Thanks for Watching" overlay banner at the end of each video by using FFMPEG's colorkey filter.
  • Combines the Auto Mashup intro video (featured in GIF format at the top of this section), hosted on Contentful, with the earlier-created main mix by first re-encoding each video with the x264 library and FFMPEG. The two videos are then concatenated with FFMPEG to create a final merged MP4 video.

Upload to YouTube and Instagram:

  • Creates a video title containing the most recent Billboard chart week date and three random artists featured in the current week's mashup video.
  • Creates a video description containing details about Auto Mashup as well as its social links. The description also contains the timestamps and song details of all of the mashups featured in the current week's mashup video.
  • Uploads the video with a custom thumbnail to Auto Mashup's YouTube channel by means of the youtube-api, which leverages YouTube's Data API - particularly the videos:insert and thumbnails:set endpoints.
  • After successful upload to YouTube, records the new YouTube URL to Contentful using the Content Management API.
  • Uploads the thumbnail image to Auto Mashup's Instagram account (@automaticmashup) using the instagram-web-api in a similar manner as featured in my other automated Instagram posting project, Daily Pixel Mike. This post features the most recent Billboard week date and three random artists featured in the current week's mashup video. A comment is automatically added to this post that includes a series of hashtags that also include the names of the three random artists featured in the caption.

Deployment

Server deployed via AWS EC2 instance. Client-side website deployed with Vercel. Custom domain from Freenom with DNS routing by Cloudflare.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Auto Mashup - [email protected]

Avraham (Avi) Mamenko - [email protected]

Project Link: https://github.com/amamenko/auto-mashup-mix

Acknowledgements

auto-mashup-mix's People

Contributors

amamenko avatar

Watchers

James Cloos 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.