ffmpeg音视频转单声道16位16K赫兹小端点pcm音频
直接看命令:
E:\BaiduNetdiskDownload>ffmpeg -i roundDeskS02E01.mp4 -acodec pcm_s16le -f s16le -ac 1 -ar 16000 roundDeskS02E01.pcm ffmpeg version git-2020-03-06-cfd9a65 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.2.1 (GCC) 20200122 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 42.100 / 56. 42.100 libavcodec 58. 73.102 / 58. 73.102 libavformat 58. 39.101 / 58. 39.101 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 77.100 / 7. 77.100 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'roundDeskS02E01.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.20.100 Duration: 00:39:54.27, start: 0.000000, bitrate: 815 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x606, 744 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default) Metadata: handler_name : SoundHandler File 'roundDeskS02E01.pcm' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help Output #0, s16le, to 'roundDeskS02E01.pcm': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.39.101 Stream #0:0(und): Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s (default) Metadata: handler_name : SoundHandler encoder : Lavc58.73.102 pcm_s16le size= 74821kB time=00:39:54.26 bitrate= 256.0kbits/s speed= 303x video:0kB audio:74821kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
参数说明:
1、-acodec pcm_s16le -> acodec:音频编码,pcm:pcm原始音频,s16:采样位为16位,le:小端点
2、-f s16le -> f:音频格式,s16le:参见上面
3、-ac 1 -> ac:声道数,指定1
4、-ar 16000 -> ar:采用率,指定16K
转好之后可以到这里试试能否正常播放http://support.bjdn.openstorage.cn/api/pcm_player/index.html。代码转化参见:JavaCV音视频转单声道16位16K赫兹小端点pcm音频