Skip to content

Commit

Permalink
tello: switch simple video playback example to use MPlayer
Browse files Browse the repository at this point in the history
Signed-off-by: Ron Evans <[email protected]>
  • Loading branch information
deadprogram committed Apr 20, 2018
1 parent 9875acb commit 5bae845
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/tello_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Do not build by default.

/*
You must have ffmpeg and ffplay installed in order to run this code. it will connect to the Tello
and then open a window using ffplay showing the streaming video.
You must have MPlayer (https://mplayerhq.hu) installed in order to run this code. it will connect to the Tello
and then open a window using MPlayer showing the streaming video.
How to run
Expand All @@ -26,9 +26,9 @@ func main() {
drone := tello.NewDriver("8890")

work := func() {
ffplay := exec.Command("ffplay", "-fast", "-i", "pipe:0")
ffplayIn, _ := ffplay.StdinPipe()
if err := ffplay.Start(); err != nil {
mplayer := exec.Command("mplayer", "-fps", "25", "-")
mplayerIn, _ := mplayer.StdinPipe()
if err := mplayer.Start(); err != nil {
fmt.Println(err)
return
}
Expand All @@ -37,14 +37,14 @@ func main() {
fmt.Println("Connected")
drone.StartVideo()
drone.SetVideoEncoderRate(4)
gobot.Every(250*time.Millisecond, func() {
gobot.Every(100*time.Millisecond, func() {
drone.StartVideo()
})
})

drone.On(tello.VideoFrameEvent, func(data interface{}) {
pkt := data.([]byte)
if _, err := ffplayIn.Write(pkt); err != nil {
if _, err := mplayerIn.Write(pkt); err != nil {
fmt.Println(err)
}
})
Expand Down

0 comments on commit 5bae845

Please sign in to comment.