Skip to content

Instantly share code, notes, and snippets.

@Samfox2
Forked from tetkuz/README.md
Created May 2, 2019 20:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Samfox2/1fff58f23e882afca50260d11c8868b3 to your computer and use it in GitHub Desktop.
Save Samfox2/1fff58f23e882afca50260d11c8868b3 to your computer and use it in GitHub Desktop.
GStreamer stream to HTML5

Description

[Server] GStreamer ---> HTML [Client]

Require

  • gstreamer-1.x
  • Browser which supports video tag of HTML5

debian

sduo apt-get install gstreamer1.0

Usage

  1. Please set a webcam to the your pc.
  2. Open index.html by the browser.
  3. Run streaming-XXXXX.sh by the terminal.
  4. You will can watch video which captured by webcam !!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>gst-stream</title>
</head>
<body>
<video width=320 height=240 autoplay>
<source src="http://localhost:8080">
</video>
</body>
</html>
#!/bin/sh
# for Linux
gst-launch-1.0 \
v4l2src device=/dev/video0 \
! videoconvert ! videoscale ! video/x-raw,width=320,height=240 \
! clockoverlay shaded-background=true font-desc="Sans 38" \
! theoraenc ! oggmux ! tcpserversink host=127.0.0.1 port=8080
#!/bin/sh
# for Windows
gst-launch-1.0 \
ksvideosrc device-index=0 \
! videoconvert ! videoscale ! video/x-raw,width=320,height=240 \
! clockoverlay shaded-background=true font-desc="Sans 38" \
! theoraenc ! oggmux ! tcpserversink host=127.0.0.1 port=8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment