/ffmpeg-youtube-live

Simple cross-platform FFMPEG streaming to YouTube

Primary LanguagePythonMIT LicenseMIT

https://travis-ci.org/scivision/ffmpeg-youtube-live.svg?branch=master https://coveralls.io/repos/github/scivision/ffmpeg-youtube-live/badge.svg?branch=master Python versions (PyPI) Distribution format (PyPI) Maintainability

FFmpeg can easily be used to stream to YouTube Live for streaming broadcasts. These Python scripts compute the optimal parameters. Should work on any OS (Mac, Linux, Windows).

Linux:requires X11, not Wayland (choose at login)
FFmpeg:>= 3.0 required
Python:>= 3.6 required

From PyPi:

python -m pip install YouTubeLiveFFmpeg

Or for the latest copy from Github:

python -m pip install -e .

In all cases, you must first configure YouTube Live. Then your chosen input will stream live on YouTube Live.

In the non-file streaming scripts, you can specify your video/audio device if desired at the top of the script. You can find device names with commands like:

  • Windows: ffmpeg -list_devices true -f dshow -i dummy
  • Mac: ffmpeg -f avfoundation -list_devices true -i ""
  • Linux: v4l2-ctl --list-devices

Audio is included:

python Webcam2YouTubeLive.py

Audio is included:

python Screenshare2YouTubeLive.py
-fps set frames/second
-res set resolution XxY of your screen
-o set origin (upper left)

Glob list of video files to stream:

python FileGlob2YouTubeLive.py path pattern
-loop optionally loop endlessly the globbed file list
python FileGlob2YouTubeLive.py ~/Videos "*.avi"
python FileGlob2YouTubeLive.py ~/Videos "*.avi" -loop

Glob list of video files to stream. Note you must include a static image (could be your logo):

python FileGlob2YouTubeLive.py path pattern -i image

path path to where video files are pattern e.g. "*.avi" pattern matching video files -i filename of image to use as stream background

e.g. stream all .mp3 audio under ~/Library directory:

python FileGlob2YouTubeLive.py ~/Library "*.mp3" -i mylogo.jpg
FileLoop2YouTubeLive.py videofile

This is NOT streaming, just saves to a file on your disk, perhaps for upload as a standard non-live YouTube video:

python ScreenCapture2disk.py myvid.avi