如何更改FFmpeg中的位深度?


14

我需要FFmpeg来获取音频供稿并将其重新编码为16位FLAC。

如何强制16位FLAC输出?

./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%

Answers:


25

默认情况下,FFmpeg FLAC编码器采用原始位的深度。可以使用以下sample_fmt选项更改位深度:

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

请注意,并非每种编码器都支持所有格式。

有关所有受支持的示例格式的列表,请运行:

ffmpeg -sample_fmts

请参阅FFmpeg命令行文档中的“ 音频选项 ”一章。


即使我指定了s16(位深度16),这也会为我生成位深度为4的输出。完整命令:ffmpeg -i newwave.wav -c:a adpcm_ima_qt -sample_fmt s16 -ar 22500 newwave.aiff
xjcl

@xjcl您使用的编解码器仅支持4位。
slhck

eg s16s16p
–theonlygusti

这对我不起作用。我收到“指定的样本格式s16无效或不受支持”
Arete

@Arete请确保您正在运行ffmpeg的最新版本,并且确实将flac编码器与FLAC输出文件配合使用。样本格式必须与所选编码器兼容。
slhck
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.