Skip to content

Instantly share code, notes, and snippets.

@apdevelop
Last active October 8, 2019 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apdevelop/8ea03ef30fa109b26eeb4fab4fb7f50d to your computer and use it in GitHub Desktop.
Save apdevelop/8ea03ef30fa109b26eeb4fab4fb7f50d to your computer and use it in GitHub Desktop.
Useful ffmpeg audio snippets

Useful ffmpeg audio snippets

  • Generating 400Hz sine wave, encoding it with G.711 μ-law codec and streaming using RTP/UDP protocol (PCMU)

ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://127.0.0.1:16384

output format will be: Stream #0:0: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s

  • Cropping audio file at given position and length

ffmpeg -ss <start> -i input.wav -t <duration> out.wav

start in seconds

duration in seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment