Skip to content

Instantly share code, notes, and snippets.

View jcelerier's full-sized avatar
🏳️‍🌈
bash the fash

Jean-Michaël Celerier jcelerier

🏳️‍🌈
bash the fash
View GitHub Profile
@kajott
kajott / vaapi_egl_interop_example.c
Last active February 27, 2024 06:43
example code for minimal-overhead hardware-accelerated video decoding and display on Linux using VA-API/EGL interoperability
#if 0 // self-compiling code: chmod +x this file and run it like a script
BINARY=vaapi_egl_interop_example
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -fsanitize=address -o $BINARY $0 \
`pkg-config libavcodec libavformat libavutil libva gl egl libdrm --cflags --libs` \
-lX11 -lva-x11 -lva-drm || exit 1
test "$1" = "--compile-only" && exit 0
exec env ASAN_OPTIONS=fast_unwind_on_malloc=0 ./$BINARY $*
#endif /*
Minimal example application for hardware video decoding on Linux and display
@djarek
djarek / send_fd.cpp
Created December 6, 2018 01:59
send_fd.cpp
#include <boost/asio/coroutine.hpp>
#include <boost/asio/local/connect_pair.hpp>
#include <boost/asio/local/stream_protocol.hpp>
#include <iostream>
#include <sys/wait.h>
std::size_t
send_fd(boost::asio::local::stream_protocol::socket& socket,
int fd,
boost::system::error_code& ec)
@sjgriffiths
sjgriffiths / SparseSet.h
Last active March 6, 2023 20:16
Sparse set (C++)
/**
SparseSet.h
Implements a class template of a sparse
set of unsigned integers.
@author Sam Griffiths
www.computist.xyz
*/
#pragma once
@jeffpamer
jeffpamer / encode.sh
Created March 16, 2018 19:38
Smooth Scrubbing Web Video FFMPEG Mega Command
ffmpeg -i input.mp4 -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 -an -vf "scale=-1:1440, reverse" -preset veryslow -g 2 output.mp4
// -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3
// Encode for web with a good balance of browser compatibility and compression ratio
// -an
// Strip audio tracks
// -vf "scale=-1:1440, reverse"
// Scale video to 1440px wide, maintaining aspect ratio
@bsenftner
bsenftner / gist:ba3d493fa36b0b201ffd995e8c2c60a2
Created February 8, 2018 15:34
libav modification of libavformat/utils.c providing support for unexpected stream termination in live RTSP or similar video streams.
// Inside the file libavformat/utils.c is the routine "int av_read_frame(AVFormatContext *s, AVPacket *pkt)", one of the key routines
// used to play video streams through FFMPEG's libav. This routine does not handle the situation when a live stream terminates
// unexpectedly, such as the unplugging of a network connection, power loss to a camera, or other reasons an established connection
// would unexpectedly stop delivering packets.
// Below is the beginning of av_read_frame() up to and a bit past the three added lines necessary to support calling of the installed
// avformat interrupt callback. The conventional libav behavior is to call the avformat interrupt callback while establishing a new
// connection with a live stream. It is not called while the stream is playing, therefore no opportunity is provided to the client
// software to recognise unexpected stream termination.
// The three lines are added to the code pasted below. They should be easy to identify:
This work, excluding the Arch Linux logo, is made available under CC0: https://creativecommons.org/publicdomain/zero/1.0/
@cryzed
cryzed / fix-infinality.md
Last active January 19, 2024 08:56
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@targodan
targodan / LICENSE
Last active December 20, 2023 13:39
Complementing code for my blog post "Decoding audio files with ffmpeg": https://www.targodan.de/post/decoding-audio-files-with-ffmpeg
The MIT License (MIT)
Copyright (c) 2016 Luca Corbatto
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@probonopd
probonopd / melvanimate.md
Last active December 11, 2017 18:52
Getting Melvanimate to fly :-)

Getting Melvanimate to fly :-)

What is Melvanimate?

Melvanimate is a library for ESP8266 that lets you control your Neopixels over WLAN easily. It supports everything imaginable besides toasting your toast, e.g.,:

  • Animate Neopixels (hence the name!) or set them to solid colors
  • Control LEDs via a web interface (for casually setting a certain color of effect)
  • Control LEDs via MQTT or DMX/E131 (for automation)
  • Adalight DIY ambient monitor lighting similar to Ambilight
@vidavidorra
vidavidorra / auto-deploy_documentation.md
Last active February 19, 2023 17:37
Auto-deploying Doxygen documentation to gh-pages with Travis CI

Auto-deploying Doxygen documentation to gh-pages with Travis CI

This explains how to setup for GitHub projects which automatically generates Doxygen code documentation and publishes the documentation to the gh-pages branch using Travis CI. This way only the source files need to be pushed to GitHub and the gh-pages branch is automatically updated with the generated Doxygen documentation.

Sign up for Travis CI and add your project

Get an account at Travis CI. Turn on Travis for your repository in question, using the Travis control panel.

Create a clean gh-pages branch

To create a clean gh-pages branch, with no commit history, from the master branch enter the code below in the Git Shell. This will create a gh-pages branch with one file, the README.md in it. It doesn't really matter what file is uploaded in it since it will be overwritten when the automatically generated documentation is published to th