20

I need FFmpeg to grab an audio feed and reencode it to 16-Bit FLAC.

How do I force a 16-Bit FLAC output?

./ffmpeg -i http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC -vn -ac 1 -ar 16000 -acodec flac -map 0 -f segment -segment_list /flac/out.list -segment_time 00:00:12.00 /flac/out%03d.flac
ffmpeg version N-49622-g127ff88 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  6 2013 05:11:38 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32 --extra-cflags='-m32 -I/root/ffmpeg-static/32bit/include -static' --extra-ldflags='-m32 -L/root/ffmpeg-static/32bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[aac @ 0xa163680] max_analyze_duration 5000000 reached at 5015510 microseconds
[aac @ 0xa163680] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC':
  Duration: 150:52:44.61, bitrate: 29 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, stereo, fltp, 29 kb/s
[flac @ 0xa16ee40] encoding as 24 bits-per-sample
Output #0, segment, to '/flac/out%03d.flac':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Audio: flac, 16000 Hz, mono, s32, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> flac)
Press [q] to stop, [?] for help
size=N/A time=00:00:19.22 bitrate=N/A    
video:0kB audio:647kB subtitle:0 global headers:0kB muxing overhead -100.003322%
slhck
  • 235,242
xulen
  • 305
  • 1
  • 2
  • 7

2 Answers2

32

By default, the FFmpeg FLAC encoder takes the bit depth of the original. The bit depth can be changed with the sample_fmt option, e.g.

ffmpeg -i … -c:a flac -sample_fmt s16 output.flac

Note that not all formats are supported by every encoder.

For a list of all supported sample formats, run:

ffmpeg -sample_fmts

See the chapter Audio Options in the FFmpeg command line documentation.

slhck
  • 235,242
4

To reduce bit depth to 16 with dithering:

ffmpeg -i input.flac -acodec flac -af aresample=osf=s16:dither_method=triangular_hp output.flac

See e.g. https://www.waves.com/audio-dithering-what-you-need-to-know

bvargo
  • 177