Created
June 7, 2020 22:20
-
-
Save misterhay/4324b7339d58253da80c9cf1aee44f0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
stream_key = 'xxxx-xxxx-xxxx-xxxx' | |
recording_path = '/home/username/Videos' | |
ffmpeg_path = '' | |
print("If you haven't started the recording already, press Ctrl-c to cancel this...") | |
from datetime import datetime | |
from pathlib import Path | |
import os | |
# find the newest file in the folder | |
p = Path(recording_path) | |
time, newest_file = max((f.stat().st_mtime, f) for f in p.iterdir()) | |
youtube_server = 'rtmp://a.rtmp.youtube.com/live2/' | |
command = ffmpeg_path+'ffmpeg -re -i '+str(newest_file)+' -acodec copy -vcodec copy -f flv '+youtube_server+stream_key | |
os.system(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment