From f97f3c2550d04349b4c1d25e20f458066a8db731 Mon Sep 17 00:00:00 2001 From: "Joseph B. Konno" Date: Mon, 3 Jul 2023 05:12:24 +0000 Subject: [PATCH] anonradio: add ffmpeg transcode preset Also provide token documentation and a real example. Signed-off-by: Joseph B. Konno --- anonradio/README.md | 20 ++++++++++++++++++++ anonradio/transcode.bash | 10 ++++++++++ anonradio/transcode.ffpreset | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 anonradio/README.md create mode 100644 anonradio/transcode.bash create mode 100644 anonradio/transcode.ffpreset diff --git a/anonradio/README.md b/anonradio/README.md new file mode 100644 index 0000000..0b40ce1 --- /dev/null +++ b/anonradio/README.md @@ -0,0 +1,20 @@ +# aNONradio + +For the coolest DJs on the interwebs. + +The magic values for the encoder? They come from the [Open Mic page][openmic]. + +[openmic]: https://anonradio.net/openmic/ + +## ffmpeg + +`transcode.ffpreset` shows how you provide arguments to ffmpeg in a file instead of the command line. In preset files, you can also add comments. Anyone who's spent any time with ffmpeg knows the argument list can get out of control quickly. Note this is a "generic" preset example-- you can get fancy by adding per-codec presets. If you want the full story, consult [the documentation][ffpresets]. + +`transcode.bash` just puts things together, and takes two positional arguments: +- input filename +- output filename + +Example invocation: +- `$ bash transcode.bash sintel_trailer-audio.flac trailer.mp3` + +[ffpresets]: https://ffmpeg.org/ffmpeg.html#Preset-files diff --git a/anonradio/transcode.bash b/anonradio/transcode.bash new file mode 100644 index 0000000..3d2eaf9 --- /dev/null +++ b/anonradio/transcode.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: 0BSD + +if [ -z $1 ] || [ -z $2 ]; then + echo "ERROR: expecting 2 arguments: input file (1) and output file (2)" + exit 1 +fi + +FFMPEG_DATADIR="$PWD" \ + ffmpeg -i "$1" -fpre transcode.ffpreset "$2" diff --git a/anonradio/transcode.ffpreset b/anonradio/transcode.ffpreset new file mode 100644 index 0000000..a0d8cf0 --- /dev/null +++ b/anonradio/transcode.ffpreset @@ -0,0 +1,4 @@ +acodec=libmp3lame +ac=2 +ar=44100 +b=192k