Skip to content

Instantly share code, notes, and snippets.

View wpbf_crop_featured_image.css
@tylercubell
tylercubell / wordpress_backup.sh
Created Jul 30, 2020
WordPress backup script.
View wordpress_backup.sh
#!/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 Feb 14, 2019
GStreamer Python HLS to YouTube Live
View hls_to_youtube_live.py
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 Feb 14, 2019
GStreamer Python YouTube Livestream
View youtube_livestream.py
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 Feb 11, 2019
GStreamer Automatically Restart Live Stream On Error
View automatically_restart_live_stream.py
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 Feb 7, 2019
GStreamer Python Add/Remove Source Dynamically
View add_remove_source_dynamically.py
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 Feb 7, 2019
GStreamer Python Custom Message
View custom_message.py
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 Apr 21, 2021
GStreamer Python Playbin Custom Video-sink
View playbin_custom_video-sink.py
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 Feb 4, 2019
GStreamer Infinite Loop Version 2
View infinite_loop_version_2.py
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 Feb 4, 2019
GStreamer Python Infinite Loop
View infinite_loop.py
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")