我有一个带有音频通道的 AVI 视频文件,我想使用 FFMpeg (v n4.3.1) 将该音频保存到 wav 文件中。对于其他类似任务,我发现此命令有效:
ffmpeg -i videofile.avi -acodec pcm_s16le -ar 22000 -y -ac 2 audiofile.wav
但是,对于当前文件,Ffmpeg 返回此错误
该文件确实有音频。VLC 可以播放音频,MediaInfo 显示以下内容:
奇怪的是,当我尝试使用旧版本的 FFMpeg(2013 年 4 月)时,它可以工作并且保存了音频。
我更喜欢使用最新的 ffmpeg。也许我需要更改我正在使用的命令行参数?
--编辑:整个 ffmpeg 输出--
ffmpeg version n4.3.1-ffmpeg-windows-build-helpers Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.1.0 (GCC)
configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/runner/work/ffmpeg-windows-builds/ffmpeg-windows-builds/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-libvmaf --enable-libsrt --enable-libaribb24 --enable-demuxer=dash --enable-libxml2 --enable-opengl --enable-libdav1d --enable-cuda-llvm --enable-libaom --enable-libvpx --enable-nvenc --enable-nvdec --extra-libs=-lharfbuzz --extra-libs=-lm --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-gpl --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-libdavs2 --enable-libxavs2 --enable-libxavs --enable-avresample --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/home/runner/work/ffmpeg-windows-builds/ffmpeg-windows-builds/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[avi @ 00000133ff187cc0] sample size (1) != block align (4)
[avi @ 00000133ff187cc0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 640x480, 3942 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'Rec1_0001.avi':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 640x480, 3942 kb/s, 24.99 fps, 24.99 tbr, 24.99 tbn, 24.99 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'Rec1_0001.wav':
Metadata:
ISFT : Lavf58.45.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22000 Hz, stereo, s16, 704 kb/s
Metadata:
encoder : Lavc58.91.100 pcm_s16le
size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
答案1
这似乎是 ffmpeg 的一个问题,我现在已经在 ffmpeg trac 上提交了一张票。感谢 @llogan 对此的帮助。