forked from BurntSushi/nflvid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes
103 lines (64 loc) · 3.74 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Game keys must be retrieved for every game played. Each game key will require a
one time request to a URL like:
http://www.nfl.com/gamecenter/2012100709/2012/REG5
The components of the URL can be constructed from data in nflgame/schedule.py.
The actual game key can be found in a comment like so:
<!-- gamekey : 55577 -->
N.B. Game keys are more easily accessible via XML schedules. They are labelled
as "gsis" ids. Example URL:
http://www.nfl.com/ajax/scorestrip?season=2012&seasonType=REG&week=1
The game keys have now been added to game meta data in nflgame:
https://github.com/BurntSushi/nflgame/blob/master/nflgame/schedule.py
These IDs are what the Neulion content provider uses to identify games. Note
that the existence of a `gamekey` in a GameCenter page does not necessarily
mean there is NFL Game Rewind data. In particular, at this moment in time, it
appears that only the 2012 season is publicly available.
The gamekey should be associated with the appropriate game in
nflgame/schedule.py.
The game key can now be used to access play meta data via an XML API:
http://smbsolr.cdnak.neulion.com/solr/nflplay/select?fl=*&rows=1000&q=GameId:55577
This might be a better URL since we don't care about searching:
http://e2.cdnl3.neulion.com/nfl/edl/nflgr/2012/55577.xml
The key pieces of information here are contained within each `<doc>...</dov>`
node. Namely, the `ArchiveTCIN` and `PlayID` fields. The `ArchiveTCIN` field
provides the exact seek time in the video in which the play begins, while the
`PlayID` field (in combination with the gamekey) uniquely identifies a single
play from the GameCenter JSON data.
Finally, the actual video can now be gathered using the following URL:
http://nlds82.cdnl3nl.neulion.com/nlds_vod/nfl/vod/2012/10/07/55577/2_55577_den_ne_2012_h_whole_1_4500.mp4.m3u8
The key things that change in the URL are the date, the game key, the 2 or 3
letter team abbreviations and the quality (with 4500 being the highest, and
the other choices being: 3000, 2400, 1600, 1200, 800, 400).
The away team is first followed by the home team. The "m3u8" extension makes
this compatible with clients that can read Http Live Streams (HLS). Among those
clients are `vlc` and `ffmpeg`. For example, to use `ffmpeg` to download and
encode the video:
ffmpeg -i '{THE URL ABOVE}' -strict -2 den_ne_2012_55577.mp4
This command can take a while, particularly if you are downloading the highest
quality available.
Thus, play data in `nflgame` can now be trivially mapped to video of that play.
Here's an example of slicing out a single play from a game:
ffmpeg -ss 00:14:28.26 -i nyj_ne_2012_55604_1600.mp4 -t 72 -map 0 -strict -2 test.mp4
Coache's film
=============
It's an rtmp stream at the following URL:
rtmp://neulionms.fcod.llnwd.net/a5306/e1/mp4:u/nfl/nfl/coachtapes/{SEASON}/{GAMEKEY}_all_1600
Where SEASON is the 4 digit year of the season and GAMEKEY is the game key
as discussed above, e.g., 55577.
To download an rtmp stream, use the `rtmpdump` command:
rtmpdump -r '{URL}' > whatever.mp4
It should then be playable in any capable video player.
Various commands
================
To probe a video file and get info such as duration and frame size:
ffprobe -show_streams -show_format -of json \
./full/2012090904-55513.mp4 2>/dev/null
To write text on an image. (May not fit, though...)
convert -size 640x480 -background SteelBlue1 -fill black -font Helvetica
-pointsize 72 -gravity center
label:"Wat wat in the butt" titlecard.jpg
To convert an image to an mp4 video that is 2 seconds long:
ffmpeg -f image2 -loop 1 -r:v 7 -i titlecard.jpg -pix_fmt yuv420p
-an -t 2 titlecard.mp4
To add subtitles:
ffmpeg -i 3400.mp4 -i test.srt -scodec mov_text 3400-sub.mp4