Skip to content

Instantly share code, notes, and snippets.

View vortextemporum's full-sized avatar

Berk Özdemir vortextemporum

View GitHub Profile
@CAD97
CAD97 / _about.md
Last active June 1, 2020 16:50
Python script to use ffmpeg to split mp4 with a video stream and three audio streams into component parts

Why

I use OBS to record and stream, and it allows me to record multiple audio streams to the output container (.mp4). The advantage to doing this is that in post-production (for the recordings) I can then adjust the relative volumes of the differing streams if the balance wasn't perfect in recording. Thus, I'm recording a mixed track 1, my voice only to track 2, and my computer sound out to track 3. (Streaming only takes one track.)

Unfortunately, my editing software (Adobe Premiere Elements 12) doesn't handle multiple audio streams on a .mp4 container. Thus, before I can benefit from having the multiple streams, I need to seperate them out of their container.

The same goes for using Audacity; if I want to mix the separate tracks together using audio editing software, I need to detatch it from the video first.

Thankfully, ffmpeg, which I already had installed, can accomplish this task very easily. It was just a matter of looking up the exact command to split the streams from the input file to seper

@shivshank
shivshank / vox_to_obj_exporter.py
Last active January 26, 2025 14:00
Exports from MagicaVoxel VOX to OBJ. Can preserve all edges for easy editing in a program like Blender.
"""
This script is designed to export a mass amount of MagicaVoxel .vox files
to .obj. Unlike Magica's internal exporter, this exporter preserves the
voxel vertices for easy manipulating in a 3d modeling program like Blender.
Various meshing algorithms are included (or to be included). MagicaVoxel
uses monotone triangulation (I think). The algorithms that will (or do)
appear in this script will use methods to potentially reduce rendering
artifacts that could be introduced by triangulation of this nature.
import processing.video.*;
Capture cam;
int N = 0;
int glitchAmount = 50;
void setup() {
size (1200,600);
background(255);
@JosephRedfern
JosephRedfern / YouTube 8m Video ID scraper.py
Last active April 8, 2025 13:24
Scrapes the youtube video IDs for the youtube-8m data set. Probably buggy. Could be threaded.
import requests
from collections import defaultdict
csv_prefix = "https://research.google.com/youtube8m/csv"
r = requests.get("{0}/verticals.json".format(csv_prefix))
verticals = r.json()
block_urls = defaultdict(list)
count = 0
@pvomelveny
pvomelveny / Gifs_Galore.ipynb
Created October 19, 2016 21:45
Convert video files on AWS S3 to gifs. Lots of them. With a modicum of concurrency too.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@agalera
agalera / split_video.py
Created February 6, 2017 09:32
split video with moviepy
from moviepy.editor import *
from multiprocessing import Process, Semaphore
import sys
segment_length = float(sys.argv[1])
frames = float(sys.argv[2])
original_video = VideoFileClip("original.mp4")
duration = original_video.duration
clip_start = 0
@eruffaldi
eruffaldi / movieslicing.py
Created February 26, 2017 22:00
Moviepy slicing in time and space
# Clips and Crops moviepy videos using slicers
#
# Emanuele Ruffaldi 2017
#
from moviepy.editor import *
import moviepy.video.fx.crop
# TODO support multiple ranges
# TODO normalized time
class TSlicer:
@dlublin
dlublin / ffmpeg-hap-readme.md
Created April 18, 2017 13:40
Encoding to Hap from the command line using FFmpeg

Encoding to Hap from the command line using FFmpeg

For users who prefer working with a command line or need to access advanced encoding settings for Hap the popular FFmpeg library can be used to work with Hap movies.

  1. If this is your first time using FFmpeg you may need to install it on your system, or compile it from source. In either case be sure that Snappy is enabled as part of the binary. If you already have FFmpeg on your system with Snappy enabled, you can skip this step.

    You can check that your version of FFmpeg can encode Hap using

    ffmpeg -encoders | grep hap
    
@Chaircrusher
Chaircrusher / grabRackPlugins.sh
Last active March 29, 2018 20:31
Script To Grab VCVRack binary plugins
# check for the community repo locally
# USAGE grabPlugins.sh <target>
# Where <target> is one of win, lin, or mac
if [ $# -gt 0 ]
then
platform="${1}"
else
platform=lin
fi
@CatherineH
CatherineH / layering svgs with javascript.html
Last active June 21, 2023 13:22
two ways to layer SVGs with javascript
<html>
<body>
<p>Quick SVG</p>
<svg id="quickSVG"></svg>
<p>DOM SVG</p>
<svg id="appendSVG"></svg>
<script>
var circle ="<svg>\n" +
" <ellipse\n" +