2

I'm trying to use ffmpeg to convert and normalize the audio in a wav file on a Windows 7 machine. It seems like I can do either with no problem, but any time I try to do both I receive this error from Windows Media Player trying to play it: "Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file."

Now, this is strange to me because if I just convert the file or if I just normalize it there is no problem playing it. Also, it doesn't seem to matter which order I do the operations in or if I try them in one line; the result is always the same.

For reference when I am converting the file I am using ffmpeg -i infile.wav -c:a aac -b:a 64k outfile.m4a and when I am normalizing it I am using ffmpeg -i infile -af "loudnorm" outfile.

Has anyone run into this or have any ideas for solutions?

Update with log: I don't have access to the full size files I'm converting right now, but below is the log for the combined call on a test file made on the same equipment.

ffmpeg started on 2017-06-12 at 10:11:32
Report written to "ffmpeg-20170612-101132.log"
Command line:
ffmpeg -i R_20170515-195003.wav -af loudnorm -report -c:a aac -b:a 64k outfile.m4a
ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'R_20170515-195003.wav'.
Reading option '-af' ... matched as option 'af' (set audio filters) with argument 'loudnorm'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '64k'.
Reading option 'outfile.m4a' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url R_20170515-195003.wav.
Successfully parsed a group of options.
Opening an input file: R_20170515-195003.wav.
[file @ 03309820] Setting default whitelist 'file,crypto'
[wav @ 03309100] Format wav probed with size=2048 and score=99
[wav @ 03309100] Before avformat_find_stream_info() pos: 44 bytes read:65580 seeks:1 nb_streams:1
[wav @ 03309100] probing stream 0 pp:32
[wav @ 03309100] probing stream 0 pp:31
[wav @ 03309100] probing stream 0 pp:30
[wav @ 03309100] probing stream 0 pp:29
[wav @ 03309100] probing stream 0 pp:28
[wav @ 03309100] probing stream 0 pp:27
[wav @ 03309100] probing stream 0 pp:26
[wav @ 03309100] probing stream 0 pp:25
[wav @ 03309100] probing stream 0 pp:24
[wav @ 03309100] probing stream 0 pp:23
[wav @ 03309100] probing stream 0 pp:22
[wav @ 03309100] probing stream 0 pp:21
[wav @ 03309100] probing stream 0 pp:20
[wav @ 03309100] probing stream 0 pp:19
[wav @ 03309100] probing stream 0 pp:18
[wav @ 03309100] probing stream 0 pp:17
[wav @ 03309100] probing stream 0 pp:16
[wav @ 03309100] probing stream 0 pp:15
[wav @ 03309100] probing stream 0 pp:14
[wav @ 03309100] probing stream 0 pp:13
[wav @ 03309100] probing stream 0 pp:12
[wav @ 03309100] probing stream 0 pp:11
[wav @ 03309100] probing stream 0 pp:10
[wav @ 03309100] probing stream 0 pp:9
[wav @ 03309100] probing stream 0 pp:8
[wav @ 03309100] probing stream 0 pp:7
[wav @ 03309100] probing stream 0 pp:6
[wav @ 03309100] probing stream 0 pp:5
[wav @ 03309100] probing stream 0 pp:4
[wav @ 03309100] probing stream 0 pp:3
[wav @ 03309100] probing stream 0 pp:2
[wav @ 03309100] probing stream 0 pp:1
[wav @ 03309100] probed stream 0
[wav @ 03309100] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 03309100] All info found
[wav @ 03309100] After avformat_find_stream_info() pos: 204844 bytes read:294956 seeks:1 frames:50
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'R_20170515-195003.wav':
  Duration: 00:00:02.73, bitrate: 1536 kb/s
    Stream #0:0, 50, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output url outfile.m4a.
Applying option af (set audio filters) with argument loudnorm.
Applying option c:a (codec name) with argument aac.
Applying option b:a (video bitrate (please use -b:v)) with argument 64k.
Successfully parsed a group of options.
Opening an output file: outfile.m4a.
[file @ 04b90d40] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
detected 4 logical cores
[graph_0_in_0_0 @ 04c14a80] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 04c14a80] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 04c14a80] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 04c14a80] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 04c14a80] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_0 @ 04c14b80] Setting 'sample_fmts' to value 'fltp'
[format_out_0_0 @ 04c14b80] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[Parsed_loudnorm_0 @ 04c14a00] auto-inserting filter 'auto_resampler_0' between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
[format_out_0_0 @ 04c14b80] auto-inserting filter 'auto_resampler_1' between the filter 'Parsed_loudnorm_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 04b954e0] query_formats: 4 queried, 3 merged, 6 already done, 0 delayed
[auto_resampler_0 @ 04c14c00] [SWR @ 05d60060] Using fltp internally between filters
[auto_resampler_0 @ 04c14c00] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:dbl r:192000Hz
[auto_resampler_1 @ 04c14c80] [SWR @ 05d74580] Using dblp internally between filters
[auto_resampler_1 @ 04c14c80] ch:2 chl:stereo fmt:dbl r:192000Hz -> ch:2 chl:stereo fmt:fltp r:96000Hz
Output #0, ipod, to 'outfile.m4a':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0, 0, 1/96000: Audio: aac (LC) (mp4a / 0x6134706D), 96000 Hz, stereo, fltp, 64 kb/s
    Metadata:
      encoder         : Lavc57.89.100 aac
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[out_0_0 @ 04c14b00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size=       3kB time=00:00:02.73 bitrate=   9.8kbits/s speed=14.6x    
video:0kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 112.246193%
Input file #0 (R_20170515-195003.wav):
  Input stream #0:0 (audio): 128 packets read (524288 bytes); 128 frames decoded (131072 samples); 
  Total: 128 packets (524288 bytes) demuxed
Output file #0 (outfile.m4a):
  Output stream #0:0 (audio): 256 frames encoded (262144 samples); 257 packets muxed (1576 bytes); 
  Total: 257 packets (1576 bytes) muxed
128 frames successfully decoded, 0 decoding errors
[AVIOContext @ 04c6c960] Statistics: 30 seeks, 280 writeouts
[aac @ 04c6b800] Qavg: 65294.412
[AVIOContext @ 04b95c80] Statistics: 589868 bytes read, 1 seeks
1
  • Run the commands with -report added and post those report files.
    – Gyan
    Jun 12 '17 at 13:38
2

To properly detect peaks, loudnorm changes the sample-rate of the file in the process (e.g. from 48000 Hz to 96000 Hz). I think that WMP can't cope with high sample-rates and therefore, it outputs that error.

You can specify the sample-rate with the -ar-parameter - you have to do that on a per-file-basis, always specifying the output file's sample-rate with -ar. (Usually 44100 Hz for CD-rips and 48000 Hz for video-related audio; FFmpeg shows you the input's sample-rate per default.)

For example:

ffmpeg -i infile.wav -af "loudnorm" -ar 48000 -c:a aac -b:a
64k outfile.m4a
2
  • Wow. It looks like this worked on the sample file that I have with me. I'll double check it when I get home tonight. Thank you so much for such a simple looking fix.
    – reddisht
    Jun 12 '17 at 14:17
  • it looks like that did work on the actual file. Thanks so much.
    – reddisht
    Jun 13 '17 at 0:37
1

for true peak limiting, this filter upsamples to 192 kHz. It is up to you to downsample to an appropriate sampling rate.

http://k.ylo.ph/2016/04/04/loudnorm.html

2
  • Am I right in saying that this is your page and that you programmed this? If so: I am impressed and very thankful for this filter. But one thing: It would be nice to see that explanation in FFmpeg's Filter Guide as it is very important to know of that behavior and why it does what it does. I'd do it myself, but a) I obviously don't know all of the features loudnorm has, b) I don't even know whom I would have to contact. Of course, if I am mistaken and the similarity in name is just a coincidence, then forget about all of it ;-)
    – flolilo
    Jun 27 '17 at 11:12
  • @flolilolilo I submitted a patch to improve the documentation.
    – slhck
    Aug 16 '17 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.