2

I have some video files in .MOV format and I want to extract the audio from them to .WAV files. I cannot use MP3 files as I'm trying to feed the sound into a sonographic analysis program (WASP) that takes WAV files and only WAV files. I'm sure I've done this before using mpg123, but I haven't done it for a while.
When I tried the command

mpg123 -w '2Jun2019 Dawn Chorus 1.wav' MVI_1145.MOV

I got this:

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.

and a 6.2 kb file titled 2Jun2019 Dawn Chorus 1.wav with nothing in it - when I tried to play it it came up in the player as 00 seconds long.

Please can somebody tell me what's the matter with the thing? Somebody in the chat suggested I should say what the encoding is, but I'm afraid I don't know the answer; it's not in Properties and I don't know how else to find out.

Edit: @Hermann asked what happened if I typed ffprobe MVI_1145.MOV. Here's the result, as it's much too long to put in a comment.

    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
2
  • See Hermann's answer. You can also convert the wav to mp3 with lame -h -b 320 "file.wav" "file.mp3". Ffmpeg also has the capability to convert to other video formats, if that's what you want. Note that conversions can reduce the quality from source in certain cases. Commented Jun 10, 2019 at 21:52
  • MP3 won't do, unfortunately, as I'm trying to feed the sound into a sonographic analysis program (WASP) that takes WAV files and only WAV files. (Shabby of it, but it's free so what can you expect?)
    – A. B.
    Commented Jun 10, 2019 at 22:08

2 Answers 2

4

mpg123 handles audio from "MPEG 1.0/2.0/2.5 layer I/II/III" sources. QuickTime MOV is closer to MPEG-4 (which is not explicitly supported by mpg123).

How about using ffmpeg instead?

ffmpeg -i MVI_1145.MOV -vn '2Jun2019 Dawn Chorus 1.wav'

-vn explicitly disables video. Output format is automagically detected based on filename extension.

Update: Since the input's audio stream already is uncompressed PCM, you can request a direct stream copy with -c:a copy (it sets the output audio encoder to "copy input"):

ffmpeg -i MVI_1145.MOV -c:a copy -vn '2Jun2019 Dawn Chorus 1.wav'
8
  • OK, I've now tried that, and this time got a WAV file containing 31 seconds of dead silence. Thanks for the attempt. Any idea what THAT one's about?
    – A. B.
    Commented Jun 10, 2019 at 22:05
  • @A.B. What does ffprobe MVI_1145.MOV yield?
    – Hermann
    Commented Jun 11, 2019 at 11:05
  • Well, I'm not sure how best to tell you since it's far too long for a comment; I've posted it as an answer - if there's a better idea, do edit, anyone.
    – A. B.
    Commented Jun 12, 2019 at 13:44
  • Actually I've bodged it onto the main question, since I thought of a way of doing that that more or less made sense.
    – A. B.
    Commented Jun 12, 2019 at 13:50
  • @A.B. according to ffprobe, your input is only 31 seconds long. I am fairly confident that ffmpeg does the conversion to wav properly. You can try -c:a copy to request a non-converting extraction. Are you sure the input is not filled with silence? Are you maybe willing to share your input file?
    – Hermann
    Commented Jun 12, 2019 at 21:09
1

What happens if you try:

ffmpeg -i your_file.wav -c:a pcm_s16le -ar 48000 -b:a 1536k output.wav
3
  • 2
    @0xSheepdog the "what happens if you try" phrasing isn't the best; it does appear to be an attempt to answer the question. user2752471, if you're actually unsure of your answer, it'd be better to (gain a few reputation points and then) post a comment to see what the results are. Otherwise, if you think you have an answer, you might avoid "questioning" phrases like "Try this" or "What happens if".
    – Jeff Schaller
    Commented Jun 12, 2019 at 17:05
  • Answering the question, so the poster or whoever else can edit it if necessary: You meant ffmpeg -i your_file.MOV -c:a pcm_s16le -ar 48000 -b:a 1536k output.wav - I realised when I tried to fill it in that you'd put "wav" instead of "MOV". Easily done. With that alteration, yes, that works too, well done.
    – A. B.
    Commented Jun 13, 2019 at 20:53
  • @ Jeff Schaller. Thanks for the suggestions. I was sure that it worked with files that I have here, but unsure about his file. Anyway, I did not know when to use one and when to use the other. However, I did try to comment first, only to realize that I cannot do so because I do not have 50 of reputation. Commented Jun 13, 2019 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .