Skip to content

Instantly share code, notes, and snippets.

View andrewmd5's full-sized avatar
💭
🖤

andrew andrewmd5

💭
🖤
View GitHub Profile
@davidfowl
davidfowl / Minimal-protobuf.cs
Last active October 8, 2024 09:15
Minimal + protobuf
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.WebUtilities;
using ProtoBuf;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "POST a protobuf message to the /");
app.MapPost("/", (Proto<Person> p) => Results.Extensions.Protobuf(p.Item))
.Accepts<Person>("application/protobuf");
@marcduiker
marcduiker / ffmpeg_video_for_twitter.md
Last active June 1, 2024 04:35
FFmpeg command for creating video for Twitter

Convert pngs to mp4

This FFmpeg command reads images named frame_[4 char digit].png and converts it to an mp4 using the h264 encoding which Twitter accepts. The bitrate is set to 5M to reduce blocking as much as possible while keeping the size small.

ffmpeg -framerate 10 -i frame_%04d.png -c:v h264_qsv -b:v 5M video.mp4

Convert and scale an existing mp4 to 1080:

ffmpeg -i input.mp4 -c:v h264_qsv -vf: scale=1080:-1 -b:v 5M output.mp4

// Uncompressed version of
// https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#include <stdbool.h> // 2008-2019
const int HEIGHT = 40;
const int WIDTH = 80;