Skip to content

Instantly share code, notes, and snippets.

View seatedro's full-sized avatar

ro seatedro

  • Perplexity
  • nether realm
View GitHub Profile
@seatedro
seatedro / avi.html
Created October 3, 2024 22:10
furthest i got to an avi demuxer
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AVI Video Player</title>
</head>
<body>
@seatedro
seatedro / yacine.html
Last active October 3, 2024 03:17
transcoder_from_scratch_in_js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>webcodecs</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
@seatedro
seatedro / build.zig
Created September 18, 2024 18:47
static ffmpeg zig build
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.Build) !void {
const av = b.option(bool, "av", "Compile ffmpeg") orelse false;
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
const dep_stb = b.dependency("stb", .{});
const dep_ffmpeg = b.dependency("ffmpeg", .{});
// Add a new step for compiling Ffmpeg
import { Injectable } from '@angular/core';
import { Socket } from 'socket.io-client';
// Stream Audio
let bufferSize = 2048,
AudioContext;
//audioStream constraints
const constraints = {
audio: true,
import { io, Socket } from 'socket.io-client';
import {AudioStreamer} from 'src/app/app.service';
constructor(private audioStreamer: AudioStreamer) {
this.liveTranscription = '';
this.socket = io('https://localhost:3000');
this.socket.on('connect', () => {
console.log('Socket Connection: ', this.socket?.connected);
})
this.audioStreamer._socket = this.socket;
restartStream() {
if (this.recognizeStream) {
this.recognizeStream.end();
this.recognizeStream.removeAllListeners();
this.recognizeStream = null;
}
if (this.resultEndTime > 0) {
this.finalRequestEndTime = this.isFinalEndTime;
}
this.resultEndTime = 0;
/**
* Receives streaming data and writes it to the recognizeStream for transcription
*
* @param {Buffer} data A section of audio data
*/
receiveData(data: DataView) {
if (
this.newStream &&
this.lastAudioInput.length !== 0 &&
this.recognizeStream
@seatedro
seatedro / speechToTextUtils.ts
Last active September 2, 2022 13:22
Transcription Server 1
import speech, { SpeechClient } from '@google-cloud/speech';
import { google } from '@google-cloud/speech/build/protos/protos';
import * as pumpify from 'pumpify';
import chalk from 'chalk';
import { Socket } from 'socket.io';
let speechClient: SpeechClient | null = null;
class SpeechToTextUtils {
recognizeStream!: pumpify | null;
resultEndTime = 0;
@seatedro
seatedro / server.ts
Last active August 26, 2022 13:57
Transcription Server 2
import { google } from "@google-cloud/speech/build/protos/protos";
import { Server, Socket } from "socket.io";
import speechToTextUtils from "./speechToTextUtils";
io.on("connection", (socket: Socket) => {
console.log("Socket Connection: ", socket.connected);
console.log("Socket Id: ", socket.id);
speechToTextUtils._socket = socket;
// Define socket eventListeners.
@seatedro
seatedro / server.ts
Created August 26, 2022 13:51
Transcription Server 1
import express, { Express, Request, Response } from "express";
import { createServer } from "https";
const app: Express = express();
const server = createServer(
{
key: fs.readFileSync("key.pem"),
cert: fs.readFileSync("cert.pem"),
},
app
);