Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ashellunts/ffmpeg-to-webrtc

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ashellunts/ffmpeg-to-webrtc

  • v0.0.0-20221030203020-dfde7fc40203
  • Source
  • Go
  • Socket score

Version published
Created
Source

ffmpeg-to-webrtc

ffmpeg-to-webrtc demonstrates how to send video from ffmpeg to your browser using pion.

How to run it

Open example web page

jsfiddle.net

Copy browser's SDP

In the jsfiddle the top textarea is your browser's SDP, copy that to clipboard.

Windows
  1. cd src
  2. Paste the SDP into a file src/SDP.txt.
  3. Make sure ffmpeg in your PATH and golang is installed.
  4. Run go run . <ffmpeg command line options> - < SDP.txt
  5. Note dash after ffmpeg options. It makes ffmpeg to write output to stdout. The app will read h264 stream from ffmpeg stdout.
  6. ffmpeg output format should be h264. Browsers don't support all h264 profiles so it may not always work. Here is an example of format that works: -pix_fmt yuv420p -c:v libx264 -bsf:v h264_mp4toannexb -b:v 2M -max_delay 0 -bf 0 -f h264.

Put SDP from ffmpeg-to-webrtc into your browser

When you see SDP in base64 format printed it means that SDP is already in clipboard. So you can go to jsfiddle page and paste that into Application SDP text area.

Hit 'Start Session' in jsfiddle

A video should start playing in your browser below the input boxes.

Examples (windows)

Share camera stream

go run . -rtbufsize 100M -f dshow -i video="PUT_DEVICE_NAME" -pix_fmt yuv420p -c:v libx264 -bsf:v h264_mp4toannexb -b:v 2M -max_delay 0 -bf 0 -f h264 - < SDP. There is a delay of several seconds. Should be possible to fix it with better ffmpeg configuration.

To check list of devices: ffmpeg -list_devices true -f dshow -i dummy.
It is possible also to set a resolution and a format, for example -pixel_format yuyv422 -s 640x480. Possible formats: ffmpeg -list_options true -f dshow -i video=PUT_DEVICE_NAME.

Share screen or window

See .bat files in src folder

Linux, macOS

Should work on other operating systems, though I haven't tried.

FAQs

Package last updated on 30 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc