Skip to content

Instantly share code, notes, and snippets.

@cyberorg012
cyberorg012 / ffmpeg-html5
Created April 11, 2020 10:24 — forked from yellowled/ffmpeg-html5
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. Will probably convert this to a bash script later, but for the time being, here's some examples. Not sure there have actually sensible dimensions and bitrates for web video.
# webm
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm
# mp4
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4
# ogg (if you want to support older Firefox)
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
}
int main(int argc, char* argv[])
{
const char * kInputFileName = "f:/Projects/Temp/testFFMPEG2/test/test_in.avi";
const char * kOutputFileName = "f:/Projects/Temp/testFFMPEG2/test/text_out.avi";
@cyberorg012
cyberorg012 / adapter.js
Created February 24, 2020 05:25 — forked from isao/adapter.js
est3k hackday files with code liberally borrowed from various places too hastily to credit :/
var RTCPeerConnection = null;
var getUserMedia = null;
var attachMediaStream = null;
var reattachMediaStream = null;
var webrtcDetectedBrowser = null;
var webrtcDetectedVersion = null;
function trace(text) {
// This function is used for logging.
if (text[text.length - 1] == '\n') {
var server = null;
if(window.location.protocol === 'http:')
server = "http://" + window.location.hostname + ":8088/janus";
else
server = "https://" + window.location.hostname + ":8089/janus";
var bitrateTimer = null;
var spinner = null;
var simulcastStarted = false, svcStarted = false;
@cyberorg012
cyberorg012 / browser_mcu_mix_record.js
Created February 24, 2020 05:24 — forked from mganeko/browser_mcu_mix_record.js
Browser MCU mix recording
let remoteVideo0 = document.getElementById('webrtc-remote-video-0');
let remoteVideo1 = document.getElementById('webrtc-remote-video-1');
let remoteVideo2 = document.getElementById('webrtc-remote-video-2');
let remoteVideo3 = document.getElementById('webrtc-remote-video-3');
let canvasMix = document.getElementById('canvas_mix');
let ctxMix = canvasMix.getContext('2d');
ctxMix.fillStyle = 'rgb(128, 192, 128)';
let mixStream = null;
// NOTE: This gist uses simplewebrtc and is based on the simple example on the homepage
// https://simplewebrtc.com
var roomName = 'your-secret-room-name';
console.log('roomName = ' + roomName);
var webrtc;
// need to enumerate devices if possible
var hasAudio = false; // default false for compatibility
var hasVideo = false;
@cyberorg012
cyberorg012 / ffmpegToWeb.js
Created December 17, 2019 07:55 — forked from moeiscool/ffmpegToWeb.js
FFMPEG to Web Browser with Express, Socket.IO and JSMPEG
// Shinobi (http://shinobi.video) - FFMPEG H.264 over HTTP Test
// How to Use raw H.264 (Simulated RTSP)
// 1. Start with `node ffmpegToWeb.js`
// 2. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 3. Open VLC and "Open Network Stream".
// 4. Input the following without quotes : `http://127.0.0.1:8001/h264` and start.
var child = require('child_process');
var io = require('socket.io');
var events = require('events');