Changes between Version 5 and Version 6 of audio types
- Timestamp:
- Aug 4, 2017, 11:11:58 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
audio types
v5 v6 1 Raw audio in FFmpeg can take several different "forms" 1 = Audio Types = 2 2 3 for instance: 3 FFmpeg can read various raw audio types (sample formats) and demux or mux them into different containers (formats). For example, you can read and write raw PCM audio into a WAV container. 4 4 5 * pcm_s16le PCM means "traditional wave like format" (raw bytes, basically). 16 means 16 bits per sample, "le" means "little endian", s means "signed", u would mean "unsigned" 5 == Sample Formats == 6 6 7 You can see a list, by running a command like this on your own local box: 7 Raw audio in FFmpeg can take several different "forms", i.e. sample formats. For instance: 8 9 * `s` means "signed" (for the integer representations), `u` would mean "unsigned" 10 * 16 means 16 Bits per sample 11 * `le` means "little endian" coding for the samples 12 13 You can see a list of supported sample formats by inspecting the `ffmpeg -formats` output: 8 14 9 15 {{{ 10 16 $ ffmpeg -formats | grep PCM 11 ffmpeg version N-44123-g5d55830 Copyright (c) 2000-2012 the FFmpeg developers12 17 DE alaw PCM A-law 13 18 DE f32be PCM 32-bit floating-point big-endian … … 32 37 }}} 33 38 34 Basically these represent all the raw audio type combination possibilities. 39 These represent all the built-in raw audio sample formats. 40 41 == Reading and Writing Raw Audio == 35 42 36 43 FFmpeg can take input of raw audio types by specifying the type on the command line. For instance, to convert a "raw" audio type to a ".wav" file: 37 44 38 {{{ ffmpeg -f pcm_s32le input_filename.raw output.wav }}} 45 {{{ 46 ffmpeg -f pcm_s32le input_filename.raw output.wav 47 }}} 39 48 40 49 You can specify number of channels, etc. as well, ex: 41 50 42 {{{ ffmpeg -f u16le -ar 44100 -ac 1 -i input.raw output.wav }}} 51 {{{ 52 ffmpeg -f u16le -ar 44100 -ac 1 -i input.raw output.wav 53 }}} 43 54 44 The default for encoding .wav files it uses is pcm_s16le, you can change it by specifying an "acodec" and using the .wavfile extension:55 The default for muxing into WAV files is `pcm_s16le`. You can change it by specifying the audio codec and using the WAV file extension: 45 56 46 {{{ ffmpeg -i input -acodec pcm_s32le output.wav }}} 57 {{{ 58 ffmpeg -i input -c:a pcm_s32le output.wav 59 }}} 47 60 48 Which will create a .wav file containing audio with that codec (not a raw file) (there are also other containers that can contain raw audio packets, like pcm_bluray). If you want to create a raw file, don't use the ".wav" ending: 61 which will create a WAV file containing audio with that codec (not a raw file). There are also other containers that can contain raw audio packets, like `pcm_bluray`. 49 62 50 {{{ ffmpeg -i input -f s16le -acodec pcm_s16le output.raw }}} 63 If you want to create a raw file, don't use the WAV format, but the raw one (as seen in the table above), e.g. `s16le`, and the appropriate audio codec: 51 64 52 You can tell what encoding by this part of your output, if it says ", s16le" then it's raw, it it says ", wav," then it's wav. 53 54 {{{ > >> Output #0, s16le, to 'out.2.raw' }}} 65 {{{ ffmpeg -i input -f s16le -c:a pcm_s16le output.raw }}}
