Autonomía digital y tecnológica

Código e ideas para una internet distribuida

Linkoteca. ffmpeg


To compress for web at a reasonable broadband bitrate of about 1.5Mbps video / 128kbps audio:

ffmpeg -i source.mp4 -c:v libx264 -b:v 1.5M -c:a aac -b:a 128k target.mp4

To scale down a high-resolution source video to something more reasonable for Web (qHD for cellular, HD for broadband), the -filter:v argument is used:

ffmpeg -i source.mp4 -c:v libvpx-vp9 -b:v 0.33M -c:a libopus -b:a 96k \
-filter:v scale=960x540 target.webm

Not all audio files are created equal. Sometimes, they’re too quiet, too loud, or just off. When you find yourself with a problematic audio file, you aren’t stuck just dealing with it. FFmpeg, a powerful open-source audio utility can help. It can adjust the volume of your files and normalize them to get rid of unpleasant fluctuations in volume. What’s even better, it’s fully scriptable and even baked into Python scripts that streamline the whole thing.

MPlayer is an extremely versatile open source media player that can be surprisingly useful at the Linux command line.

MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh (88.1 WKNC, they’re pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was:

$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3