Skip to content

Instantly share code, notes, and snippets.

View superhg2012's full-sized avatar

Gang He superhg2012

  • Netease
  • Beijing, China
View GitHub Profile
@superhg2012
superhg2012 / ffmpeg.md
Created July 7, 2019 06:55 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@superhg2012
superhg2012 / ffmpeg-convert-mp3-to-wave
Created January 8, 2019 03:15 — forked from vunb/ffmpeg-convert-mp3-to-wave
Convert mp3 to wave format using ffmpeg
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
# To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done
# Or Windows:
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav