Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tylercubell's full-sized avatar

Tyler tylercubell

View GitHub Profile
@tylercubell
tylercubell / wordpress_backup.sh
Created July 30, 2020 18:34
WordPress backup script.
#!/bin/bash
# Variables.
backup_dir="backups"
files_dir="/var/www/yoursite" # Don't add trailing slash.
max_backups=14 # Two weeks.
database_name="yoursite"
timezone="US/Eastern"
# Check if script is running as root.
@tylercubell
tylercubell / hls_to_youtube_live.py
Created February 14, 2019 19:45
GStreamer Python HLS to YouTube Live
import os, gi, time
gi.require_version("Gst", "1.0")
from gi.repository import GObject, Gst
Gst.init(None)
pipeline = Gst.Pipeline()
bus = pipeline.get_bus()
# Variables.
hls_uri = "your_hls_uri"
@tylercubell
tylercubell / youtube_livestream.py
Created February 14, 2019 16:17
GStreamer Python YouTube Livestream
import os, gi
gi.require_version("Gst", "1.0")
from gi.repository import GObject, Gst
Gst.init(None)
pipeline = Gst.Pipeline()
# Variables.
youtube_stream_key = "your_key_here"
encoder_speed = "ultrafast"
@tylercubell
tylercubell / automatically_restart_live_stream.py
Created February 11, 2019 01:07
GStreamer Automatically Restart Live Stream On Error
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
Gst.init(None)
class Main:
def __init__(self):
self.pipeline = Gst.Pipeline.new("pipeline")
self.bus = self.pipeline.get_bus()
@tylercubell
tylercubell / add_remove_source_dynamically.py
Created February 7, 2019 20:08
GStreamer Python Add/Remove Source Dynamically
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
from threading import Thread, Event
Gst.init(None)
class Main:
def __init__(self):
self.pipeline = Gst.Pipeline.new("pipeline")
@tylercubell
tylercubell / custom_message.py
Created February 7, 2019 05:34
GStreamer Python Custom Message
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
from threading import Thread, Event
Gst.init(None)
class Main:
def __init__(self):
self.pipeline = Gst.Pipeline.new("pipeline")
@tylercubell
tylercubell / playbin_custom_video-sink.py
Last active November 19, 2023 13:37
GStreamer Python Playbin Custom Video-sink
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
Gst.init(None)
class Main:
def __init__(self):
self.pipeline = Gst.Pipeline.new("pipeline")
self.bus = self.pipeline.get_bus()
@tylercubell
tylercubell / infinite_loop_version_2.py
Created February 4, 2019 22:14
GStreamer Infinite Loop Version 2
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
import os
Gst.init(None)
# Short way:
# pipeline = Gst.parse_launch("filesrc name=filesource ! decodebin ! autovideosink")
# pipeline.get_by_name("filesource").set_property("location", "background.mov")
@tylercubell
tylercubell / infinite_loop.py
Created February 4, 2019 21:57
GStreamer Python Infinite Loop
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
import os
Gst.init(None)
mainloop = GObject.MainLoop()
# Short way:
# pipeline = Gst.parse_launch("filesrc name=filesource ! decodebin ! autovideosink")