Skip to content

chanshik/jsmpeg-stream-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MPEG Streaming Demo with jsmpeg.js

MPEG streaming demo with jsmpeg.js implemented by Go

Setup build environment

$ go get github.com/gorilla/websocket
$ go get github.com/gorilla/mux
$ go build

Run

Start streaming WebSocket and homepage server

$ go run stream-server.go
StreamServer parameters
  SECRET: secret
  IncomingPort: 8082
  WebSocketPort: 8084
IncomingStreamHandler starting
Demo web page listening at port 8080
WebSocketHandler starting

Start ffmpeg for incoming stream from iSight

$ ffmpeg -s 1024x576 -f avfoundation -i "0:1" \
  -f mpegts -codec:v mpeg1video -b:v 800k -r 24 -framerate 24 \
  -codec:a mp2 -b:a 128k -muxdelay 0.001 http://localhost:8082/secret

On Linux using Video4Linux2 (v4l2)

$ ffmpeg -s 1024x720 -f v4l2 -i /dev/video0 \
  -f mpegts -codec:v mpeg1video -b:v 800k -r 24 \
  -framerate 24 -codec:a mp2 -b:a 128k -muxdelay 0.001 \
  http://localhost:8082/secret

Open the page http://localhost:8080

About

MPEG1 streaming demo with jsmpeg implemented by Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published