Skip to content
systemcoding.dev

Snippets

Short posts that solve one thing: the code, the output we got, and why it works.

Media

List ALSA devices with aplay -l

List the playback cards and devices ALSA sees with aplay -l from alsa-utils 1.2, and turn the output into a hw:card,device name.

1 min read
Media

Create an instance with libvlc_new

Create a libVLC 3.0 engine instance with libvlc_new, check for NULL when plugins are missing, and print the version it loaded.

1 min read
Media

Open an input with avformat_open_input

Open a media file in C with avformat_open_input from libavformat 61 (FFmpeg 7.1), check the negative error code, and release it with avformat_close_input.

2 min read
Media

Decode on the GPU with -hwaccel cuda

Decode H.264 on an NVIDIA GPU with ffmpeg -hwaccel cuda, which uses NVDEC but copies frames back to system memory unless you also set an output format.

1 min read
Media

Rotate 90 degrees with transpose=1

Rotate video 90 degrees clockwise in FFmpeg 7.1 with transpose=1, and use 2 for counter-clockwise or two filters for a half turn.

1 min read
Media

Cut a clip of fixed length with -t

Use -t as an output option in FFmpeg 7.1 to keep exactly the first N seconds of a stream, and know how it differs from -to.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.