Documentation
¶
Overview ¶
Package annotate draws on a finished screen recording what a person watching it needs to follow the run (`tb test --record --annotate`): a ring where each tap, double tap and long press landed (a ring that moves along a swipe), and, in a band added below the recording, the step that is running. The band keeps the text off the app's screen, so it hides nothing.
tb draws the text itself (captionImage, with the Go fonts) and ffmpeg only places the images: the video needs no subtitle support from ffmpeg (libass, freetype), which builds such as Homebrew's may not have.
The device records the screen as it is; tb's own taps and swipes are not drawn there (iOS and Chrome have no setting for that, and Android's "show taps" draws a dot too small and brief to see in a video). So tb draws them afterwards with ffmpeg, from what the runner noted while it ran, the same on every platform. Burning them in, rather than a subtitle track beside the video, is what keeps them in a video attached to a pull request.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FFmpegPath = func() (string, error) { if p := os.Getenv("TB_FFMPEG"); p != "" { return p, nil } return exec.LookPath("ffmpeg") }
FFmpegPath finds ffmpeg: TB_FFMPEG, else the PATH. A variable so tests need no ffmpeg.
Functions ¶
func Burn ¶
Burn draws caps and touches onto the video at path, in place. The captions are also written beside it (the video's name with .srt). On an error the video is left as it was.
func Changes ¶
Changes lists when the picture in the video at path changes noticeably, in times from its start.
func Graph ¶
Graph is the ffmpeg filter graph for a w×h video: the video at a steady outFPS, a ring (input 1, when there are touches) over each touch, then, when there are captions, a band band pixels high added below with each caption's image (the inputs after the ring, in order) in it while its step runs. Its output is [v].
Types ¶
type Sync ¶
type Sync struct {
Shift time.Duration // add to the runner's times to get the video's
Matched int // touches followed by a change within reactWithin at Shift
Touches int
OK bool // enough touches agree to trust Shift
}
Sync is what Offset found.
func Offset ¶
Offset finds the shift that puts the touches (times by the runner's clock, from the video's start) each shortly before a change of the picture: the one that leaves the least time between each touch and the next change. That puts the quickest reaction's touch right on its change, so the shift found is the video's lag plus at most the app's quickest reaction (tens of milliseconds, under a frame or two). Between equal fits it takes the smallest shift. OK when at least two touches, and most of them, are matched.