forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

seed.sh30 lines, 1.3 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# seed.sh: write a handful of small MPEG audio seeds into fuzz/corpus/decode, using ffmpeg.
3#
4# Covers MP2 (Layer II) mono and stereo at 32 kHz, 44.1 kHz and 48 kHz, MPEG-2 LSF MP2 at
5# 22.05 kHz, and MP3 (Layer III) mono and stereo at 44.1 kHz and an LSF 22.05 kHz stream. Each
6# is a 1 s sine tone, so every seed is under 25 KB. Layer I has no encoder in ffmpeg and no
7# generator in tests/, so it has no seed; the decoder still reaches it through the same reader.
8# The corpus is not committed (see .gitignore); run this before a fuzz run.
9set -euo pipefail
10
11here=$(cd -- "$(dirname -- "$0")" && pwd)
12dst="$here/corpus/decode"
13mkdir -p "$dst"
14src="sine=frequency=440:duration=1"
15
16enc() { # enc <name> <codec> <ext> <ar> <ac> <bitrate> <format>
17 ffmpeg -v error -y -f lavfi -i "$src" -c:a "$2" -ar "$4" -ac "$5" -b:a "$6" -f "$7" "$dst/$1.$3"
18}
19
20enc mp2-mono-32k mp2 mp2 32000 1 64k mp2
21enc mp2-stereo-32k mp2 mp2 32000 2 128k mp2
22enc mp2-mono-44k mp2 mp2 44100 1 96k mp2
23enc mp2-stereo-44k mp2 mp2 44100 2 192k mp2
24enc mp2-stereo-48k mp2 mp2 48000 2 192k mp2
25enc mp2-lsf-22k mp2 mp2 22050 1 32k mp2
26enc mp3-stereo-44k libmp3lame mp3 44100 2 128k mp3
27enc mp3-mono-44k libmp3lame mp3 44100 1 64k mp3
28enc mp3-lsf-22k libmp3lame mp3 22050 1 32k mp3
29
30echo "seed.sh: $(ls "$dst" | wc -l) seeds in $dst"