我有一些 .MOV 格式的视频文件,我想将其中的音频提取为 .WAV 文件。我无法使用 MP3 文件,因为我试图将声音输入超声波分析程序 (WASP),该程序仅接受 WAV 文件。我确信我在使用 mpg123 之前已经这样做过,但我已经有一段时间没有这样做了。
当我尝试命令时
mpg123 -w '2Jun2019 Dawn Chorus 1.wav' MVI_1145.MOV
我懂了:
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.22.4; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Playing MPEG stream 1 of 1: MVI_1145.MOV ...
MPEG 1.0 layer I, 11 kbit/s (free format), 44100 Hz stereo
[layer1.c:30] error: Illegal bit allocation value.
[layer1.c:171] error: Aborting layer I decoding after step one.
[layer1.c:30] error: Illegal bit allocation value.
[layer1.c:171] error: Aborting layer I decoding after step one.
[layer1.c:30] error: Illegal bit allocation value.
[layer1.c:171] error: Aborting layer I decoding after step one.
Note: Illegal Audio-MPEG-Header 0x00000000 at offset 1330.
Note: Trying to resync...
Note: Skipped 1024 bytes in input.
[parse.c:1249] error: Giving up resync after 1024 bytes - your stream is not nice... (maybe increasing resync limit could help).
[mpg123.c:695] error: ...in decoding next frame: Failed to find valid MPEG data within limit on resync. (code 28)
[0:00] Decoding of MVI_1145.MOV finished.
还有一个 6.2 kb 的文件,标题2Jun2019 Dawn Chorus 1.wav
中没有任何内容 - 当我尝试播放它时,它在播放器中显示为 00 秒长。
请问有人可以告诉我这件事是怎么回事吗?聊天中有人建议我应该说出编码是什么,但我恐怕不知道答案;它不在属性中,我不知道如何找到。
编辑:@Hermann 问如果我输入 会发生什么ffprobe MVI_1145.MOV
。这是结果,因为它太长了,无法发表评论。
ffprobe version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_1145.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2019-06-02 02:56:02
Duration: 00:00:31.80, start: 0.000000, bitrate: 15023 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720, 13140 kb/s, 25 fps, 25 tbr, 25k tbn, 50k tbc (default)
Metadata:
creation_time : 2019-06-02 02:56:02
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2019-06-02 02:56:02
答案1
英里/加仑123处理来自“MPEG 1.0/2.0/2.5 Layer I/II/III”源的音频。 QuickTime MOV 更接近 MPEG-4(mpg123 未明确支持)。
使用 ffmpeg 代替怎么样?
ffmpeg -i MVI_1145.MOV -vn '2Jun2019 Dawn Chorus 1.wav'
-vn
明确禁用视频。根据文件扩展名自动检测输出格式。
更新:由于输入的音频流已经是未压缩的 PCM,因此您可以请求直接流副本-c:a copy
(它设置输出A音频 enC命令“复制输入”):
ffmpeg -i MVI_1145.MOV -c:a copy -vn '2Jun2019 Dawn Chorus 1.wav'
答案2
如果你尝试会发生什么:
ffmpeg -i your_file.wav -c:a pcm_s16le -ar 48000 -b:a 1536k output.wav