Skip to content

Instantly share code, notes, and snippets.

View athoik's full-sized avatar

Athanasios Oikonomou athoik

  • Future Group
  • Earth
View GitHub Profile
@athoik
athoik / python-librtmp
Created April 29, 2013 21:17
A simple python librtmp stream downloader, originally found here http://stream-recorder.com/forum/showpost.php?p=42294&postcount=8
# -*- coding: utf-8 -*-
import os
from ctypes import cdll, c_char_p, c_int, create_string_buffer, sizeof
class RTMP:
"""
This class encapsulates librtmp in order to connect to a RTMP server and get video stream.
RTMPDUMP website : http://rtmpdump.mplayerhq.hu
LIBRTMP manpage : http://rtmpdump.mplayerhq.hu/librtmp.3.html
"""
@athoik
athoik / bandwidth.py
Last active October 21, 2017 19:03
A simple bandwidth monitoring using /proc/net/dev
#!/usr/bin/env python
import time
def getRxTx():
rx = 0L
tx = 0L
with open("/proc/net/dev") as dev:
data = dev.read()
data = data.split("\n")[2:]
for iface in data:
@athoik
athoik / imagetovideo
Created November 10, 2013 06:50
Create video slideshow from images
https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
Using a single image as an input
If you want to create a video out of just one image, this will do (output video duration is set to 30 seconds with -t 30):
ffmpeg -loop 1 -i img.png -c:v libx264 -t 30 -pix_fmt yuv420p out.mp4
ffmpeg -loop 1 -i img.png -c:v libx264 -r 2 -t 10 -pix_fmt yuv420p out1.mp4
@athoik
athoik / beat.py
Last active August 12, 2017 22:57
Livestreamer be-at.tv plugin
import re
from collections import namedtuple
try:
from Crypto.Cipher import AES
CAN_DECRYPT = True
except ImportError:
CAN_DECRYPT = False
from io import BytesIO
@athoik
athoik / nicovideo.py
Created April 1, 2014 16:57
Livestreamer live.nicovideo.jp plugin
from livestreamer.compat import unquote, urlparse
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http
from livestreamer.stream import RTMPStream
from livestreamer.utils import parse_xml
PLAYER_API = "http://ext.live.nicovideo.jp/api/getplayerstatus"
class Nicovideo(Plugin):
@athoik
athoik / e2restream.py
Created June 20, 2014 20:02
e2restream
#!/usr/bin/python2.7
""" e2restream Deamon """
import os
import sys
import time
import atexit
import Queue
import hashlib
@athoik
athoik / gist:b362874b837a7bb559e6
Created December 1, 2015 17:35
Print GStreamer Elements containing connection-speed property
gst-inspect-1.0 -a | awk -F: '{ print $1 }' | sort | uniq | while read LINE; do (gst-inspect-1.0 $LINE 2>/dev/null | grep connection-speed -A
2) && echo $LINE; done
@athoik
athoik / hbbtv.log
Created December 20, 2015 14:00
my HbbTV User Agent Collection
# dm7020hd
Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (+DL+PVR+RTSP+DRM; ; ; ; ;) CE-HTML/1.0; en) Presto/2.8.115 Version/11.10
@athoik
athoik / vtuner-atsc.c
Last active April 25, 2017 20:11
A small utility to test vtuner ATSC capability
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>
#define VTUNER_GET_MESSAGE 1
@athoik
athoik / test-enum-as-define.c
Created December 19, 2016 21:13
Test If enumeration can be used in preprocessor define
#include <stdio.h>
enum fe_caps {
FE_IS_STUPID = 0,
FE_CAN_INVERSION_AUTO = 0x1,
FE_CAN_FEC_1_2 = 0x2,
FE_CAN_FEC_2_3 = 0x4,
FE_CAN_FEC_3_4 = 0x8,
FE_CAN_FEC_4_5 = 0x10,
FE_CAN_FEC_5_6 = 0x20,