Skip to content

Instantly share code, notes, and snippets.

@tayvano
tayvano / gist:6e2d456a9897f55025e25035478a3a50
Created February 19, 2017 05:29
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@Brainiarc7
Brainiarc7 / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Last active August 18, 2024 02:58
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@baines
baines / freetype-atlas.c
Created July 15, 2016 13:32
minimal freetype texture atlas example
#include <stdio.h>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#define NUM_GLYPHS 128
struct glyph_info {
int x0, y0, x1, y1; // coords of glyph in the texture atlas

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@dcat
dcat / xresource_test.c
Created June 2, 2015 00:01
Xresource example
/* $CC -o xresources_test xresources_test.c -lX11 */
#include <X11/Xresource.h>
#include <string.h>
#include <stdio.h>
#define XRESOURCE_LOAD_STRING(NAME, DST) \
XrmGetResource(db, NAME, "String", &type, &ret); \
if (ret.addr != NULL && !strncmp("String", type, 64)) \
DST = ret.addr;
@def-
def- / mainpage.c
Created February 19, 2015 10:05
CSFML example
#include <SFML/Audio.h>
#include <SFML/Graphics.h>
int main()
{
sfVideoMode mode = {800, 600, 32};
sfRenderWindow* window;
sfTexture* texture;
sfSprite* sprite;
sfFont* font;
@CallumDev
CallumDev / fontconfig.c
Created January 21, 2015 14:08
FontConfig sample in C
//compiled gcc fonttest.c -o fonttest -lfontconfig
//Sample output: /usr/share/fonts/steam-fonts/arial.ttf
#include <stdio.h>
#include <stdlib.h>
#include <fontconfig/fontconfig.h>
int main()
{
FcConfig* config = FcInitLoadConfigAndFonts();
//make pattern from font name
FcPattern* pat = FcNameParse((const FcChar8*)"Arial");
@luser-dr00g
luser-dr00g / font_transform_test.c
Created September 23, 2014 07:55
testing FT_Set_Transform with FT_Render_Glyph and accessing advance vector
//make font_transform_test CFLAGS=`freetype-config --cflags ` LDLIBS=`freetype-config --libs` LDLIBS+=`pkg-config fontconfig --libs` LDLIBS+='-lm'
/*
* Xpost - a Level-2 Postscript interpreter
* Copyright (C) 2013, Michael Joshua Ryan
* Copyright (C) 2013, Vincent Torri
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@barodeur
barodeur / main.c
Created March 19, 2013 12:32
libev example
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <ev.h>
#include <strings.h>
#define PORT_NO 3033
#define BUFFER_SIZE 1024
void accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents);