I'm trying to convert some old WMVs into MP4s, but ffmpeg will not do it. I keep getting the following error:

 input contains (near) nan/+-inf
 audio encoding failed

Exact command used is:

 ffmpeg -i input.wmv -vf "scale=320:240,setsar=1" -crf 24 -c:a aac -b:a 48k -ac 1 -movflags +faststart output.mp4

If it helps, ffprobe gives the following:

Users\name>ffprobe input.wmv
ffprobe version N-90143-gb6652f5100 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
  libavutil      56.  7.101 / 56.  7.101
  libavcodec     58. 12.102 / 58. 12.102
  libavformat    58.  9.100 / 58.  9.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 12.100 /  7. 12.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[wmv3 @ 0000020416485e40] Extra data: 8 bits left, value: 0
Input #0, asf, from 'input.wmv':
    WMFSDKNeeded    :
    DeviceConformanceTemplate: MP@LL
    WMFSDKVersion   : 11.0.5358.4827
    IsVBR           : 0
  Duration: 00:27:02.46, start: 0.000000, bitrate: 205 kb/s
    Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, 2 channels, fltp, 32 kb/s
    Stream #0:1(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 320x240, 168 kb/s, 14.99 fps, 14.99 tbr, 1k tbn, 1k tbc
[wmv3 @ 00000204164fe740] Extra data: 8 bits left, value: 0
  • Definitely related to the audio. I was able to run the following: ffmpeg -i input.wmv -crf 24 -an -movflags +faststart output.mp4. However, I got a lot of "past duration x.xxxxxx too large" warnings. – DigiVision Media Nov 16 '18 at 20:48
  • I tried to run the original command with higher and lower -b:a values, but got the same errors. – DigiVision Media Nov 16 '18 at 20:49
  • Can you share the file? – Gyan Nov 17 '18 at 5:17

If you have a ffmpeg build with libfdk_aac then you can use that encoder since it doesn't report that error.

With your current build, you have to convert the audio to 16 bit integer samples first.

ffmpeg -i input.wmv -vf "scale=320:240,setsar=1" -crf 24 -af aformat=s16p -c:a aac -b:a 48k -ac 1 -movflags +faststart output.mp4
  • Thank you. What is the actual problem though? What's wrong with the wmv's audio that I would have to do this first? – DigiVision Media Nov 17 '18 at 17:54
  • 1
    During a transform process, some of the coefficients generated were too large in some frequency bands, as best as I can tell. No connection with the input codec or format. – Gyan Nov 17 '18 at 19:10
  • Thanks, renders as expected now. Have you seen this before? I only have this happen to me on these old WMVs I have. And they're quite old. This one was captured in 2008, with tech from 2002. – DigiVision Media Nov 19 '18 at 17:05
  • 1
    No, this is an esoteric error from inside the encoding machinery. It's sort of strange that the encoder doesn't just smooth over the coefficients. – Gyan Nov 19 '18 at 17:17

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.