Automatically create an animated gif with the latest goal at the world cup
JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
hooks
img
lib
test
triggers
views
.gitignore
LICENSE
README.md
install_ffmpeg_ubuntu.sh
package.json
processes.json
server.js
settings.json
stream.js

README.md

ReplayLastGoal

Automatically create and tweet a video with the latest goal at the world cup.

Notice: It is your responsiblity to make sure that you stay within the limits of "Fair Use". Laws might be different in your country. The author and contributors of this project decline all responsibility. For reference: Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use.

Try it!

Just follow @ReplayLastGoal on Twitter.

Webhooks

You can add webhooks to automatically receive a notification when a goal is scored along with the animated gif and a link to the video replay. We support classic webhooks, Hipchat and Slack. Go to http://ReplayLastGoal.com/hooks/add to configure them.

ReplayLastGoal notification in Slack

How does it work?

It connects to a video live stream (that you need to provide) and keeps a buffer of about one minute worth of video. When a given twitter account tweets (by default @GoalFlash), it uses the buffer to generate a video of the goal and then tweets it. Videos are saved in the videos/ directory.

Press & testimonials

Requirements

A live video stream

There are a few public television channels in Europe who are live streaming the world cup. The only caveat is that your server needs to be in that country (but it's not too complicated to work around it using the cloud.)

Live streaming works either with Flash which is hard to reverse engineer or with HTML5 for mobile devices. So open the web page with the live stream with Safari and change your user agent to the iPad and you will be able to get the HTML5 version of the live stream. Then you can inspect network traffic to identify the URL of the live stream. It should end with the extension .m3u8. Use that URL in settings.json.

Audio Video Converter

You need to have ffmpeg 2.2x installed on your machine. On a Mac, it's a piece of cake. Install brew and then do brew install ffmpeg and you are done. On Ubuntu, it's a pain. This bash script should help you.

Install

git clone https://github.com/xdamman/ReplayLastGoal.git
npm install

Edit settings.json and save it as settings.development.json (or settings.production.json for production environment as set by the NODE_ENV variable.)

You are now ready to start the application:

npm start

Like it? Love it?

Share the love by tweeting or favoriting this repo! Oh, and pull requests are more than welcome! :-)

Contributors

Special thanks to Benjamin Goering (@bengo) for his help.

TODO

(Pull requests welcome)

  • Better pin point when the goal happens in the 20s window to trim down the duration of the video and gif (we could use a VU meter to identify when the sound level peaks)
  • Support for multichannels when there is more than one match at once
  • Better test coverage
  • Interface to manage webhooks and allow anyone to add their own webhook
  • Hipchat Add On
  • Slack add on
  • Generate image to send with the tweet (finding the right one might be tricky)
  • Refactoring to start streaming the video of the goal as soon as we start recording
  • Automatically turn on/off the input stream when there is a match
  • Automatically create a video summary with all the goals after the game ends