|
| 1 | +`nflvid` is a Python package that facilates the processing of NFL game footage. |
| 2 | +In particular, this library provides routines to do the following: |
| 3 | + |
| 4 | + - Download game footage from NFL's content provider (Neulion). |
| 5 | + |
| 6 | + - Download play meta data associated with game footage that, among other |
| 7 | + things, describes the start time of every play in the game. |
| 8 | + |
| 9 | + - Cut the game footage into pieces where each piece corresponds to a single |
| 10 | + play. |
| 11 | + |
| 12 | + - Provide a few API functions for accessing the file path of a particular |
| 13 | + play by integration with [nflgame](https://github.com/BurntSushi/nflgame). |
| 14 | + |
| 15 | +The methods used in this library rely heavily on the open availability of data |
| 16 | +that could be shut off at any time. More to the point, the content that this |
| 17 | +library requires is large and cannot be distributed easily. Therefore, this |
| 18 | +package's future remains uncertain. |
| 19 | + |
| 20 | +Slicing game footage into play-by-play pieces is done using meta data, which |
| 21 | +can sometimes contain errors. Not all of them are detectable, but when they |
| 22 | +are, `nflvid` can create a ten-second "stand in" video clip with a textual |
| 23 | +description of the play. |
| 24 | + |
| 25 | +The meta data for when each play starts in the footage is included in this |
| 26 | +repository and is installed automatically. |
| 27 | + |
| 28 | +The actual game footage can either be broadcast footage (with commercials |
| 29 | +removed), or it can be "all-22" (coach) footage. Broadcast footage comes in |
| 30 | +varying qualities (up to 720p HD) while "all-22" footage is limited to only |
| 31 | +standard definition (480p) quality. `nflvid` faciliates acquiring either, but |
| 32 | +getting coach footage is much more reliable and is therefore the default |
| 33 | +operation. Gathering broadcast footage is possible, but it is buggy. |
| 34 | + |
| 35 | + |
| 36 | +## Documentation |
| 37 | + |
| 38 | +The API documentation is generated from the code using `epydoc`. A copy of |
| 39 | +it can be found here: http://burntsushi.net/doc/nflvid |
| 40 | + |
| 41 | + |
| 42 | +## Installation |
| 43 | + |
| 44 | +[nflvid is on PyPI](https://pypi.python.org/pypi/nflvid), so it can be |
| 45 | +installed with `pip`: |
| 46 | + |
| 47 | + pip2 install nflvid |
| 48 | + |
| 49 | + |
| 50 | +## Dependencies |
| 51 | + |
| 52 | +`nflvid` depends on the following third-party Python packages, which are all |
| 53 | +available in `PyPI` and are installed automatically by `pip` if it's used to |
| 54 | +install `nflvid`. |
| 55 | + |
| 56 | +* [nflgame](https://pypi.python.org/pypi/nflgame) |
| 57 | +* [httplib2](https://pypi.python.org/pypi/httplib2) |
| 58 | +* [eventlet](https://pypi.python.org/pypi/eventlet) |
| 59 | +* [beautifulsoup4](https://pypi.python.org/pypi/beautifulsoup4) |
| 60 | + |
| 61 | +Additionally, the following programs are used to facilitate the downloading and |
| 62 | +slicing of video. They should be available in the standard repositories of any |
| 63 | +Linux distribution. They are not required if you already have the sliced |
| 64 | +play-by-play footage and only want to access video of a particular play given a |
| 65 | +play identifier from `nflgame`. |
| 66 | + |
| 67 | +* [ffmpeg](http://www.ffmpeg.org) |
| 68 | +* [imagemagick](http://www.imagemagick.org/) (specifically, the `convert` |
| 69 | + program) |
| 70 | +* [rtmpdump](http://www.imagemagick.org/) (to download rtmp streams) |
| 71 | + |
| 72 | + |
| 73 | +## Basic usage |
| 74 | + |
| 75 | +`nflvid` operates by understanding two different directory hierarchies. One is |
| 76 | +a directory containing one file for each game. The other is a directory with a |
| 77 | +sub-directory for each game, where each sub-directory contains a single file |
| 78 | +for each play in that game. The former is known as the `footage_dir` while the |
| 79 | +latter is known as `footage_play_dir`. |
| 80 | + |
| 81 | +To start downloading the "all-22" footage to `/home/you/pats/full` for |
| 82 | +every New England game in 2012, you could use the following command to start |
| 83 | +with: (The lone `--` before the directory is necessary since more than one team |
| 84 | +can be specified with the `--teams` option.) |
| 85 | + |
| 86 | + nflvid-footage --dry-run --season 2012 --teams NE -- /home/you/pats/full |
| 87 | + |
| 88 | +Note the use of the `--dry-run` flag. When set, this only downloads the first |
| 89 | +30 seconds of each game. The point is to test that your environment is |
| 90 | +configured correctly before starting a long-running job. If the dry run |
| 91 | +completes OK, then try playing the files it downloaded in |
| 92 | +`/home/you/pats/full`. If all is well, proceed with downloading the full |
| 93 | +video: |
| 94 | + |
| 95 | + nflvid-footage --season 2012 --teams NE -- /home/you/pats/full |
| 96 | + |
| 97 | +Sometimes video downloads can fail (although it is rare), so make sure to watch |
| 98 | +the output of `nflvid-footage`. It will tell you if a download is incomplete. |
| 99 | +If so, delete the video and re-run the command. **The program will not |
| 100 | +re-download footage that is already on disk!** |
| 101 | + |
| 102 | +Once you've downloaded some games, you can now try slicing the footage into |
| 103 | +plays. The following command will put the sliced plays into |
| 104 | +`/home/you/pats/pbp`: |
| 105 | + |
| 106 | + nflvid-slice --dry-run /home/you/pats/pbp /home/you/pats/full/*.mp4 |
| 107 | + |
| 108 | +Note once again the `--dry-run` flag. When slicing, this flag will only slice |
| 109 | +the first ten plays in a game. Although slicing doesn't take as long as |
| 110 | +downloading (since there is no transcoding), it's still worth it to try |
| 111 | +something quick to make sure things are working. After that's done, check the |
| 112 | +contents of `/home/you/pats/pbp`. You should see a directory for each game |
| 113 | +video in `/home/you/pats/full`. If the video of the plays is OK, then |
| 114 | +remove the `--dry-run` flag: |
| 115 | + |
| 116 | + nflvid-slice /home/you/pats/pbp /home/you/pats/full/*.mp4 |
| 117 | + |
| 118 | +Note that you can keep running this same command over and over again. **Plays |
| 119 | +will not be resliced if they are already on disk**. |
| 120 | + |
| 121 | +Finally, since the meta data describing the start time of each play is |
| 122 | +sometimes incomplete, you can add place-holder videos for each missing play |
| 123 | +that contain a static 10-second-long textual description of the play: |
| 124 | + |
| 125 | + nflvid-slice --add-missing-plays /home/you/pats/pbp /home/you/pats/full/*.mp4 |
| 126 | + |
| 127 | +Please check out `nflvid-footage --help` and `nflvid-slice --help` for more |
| 128 | +options. |
| 129 | + |
0 commit comments