How to remove video streams from .wmv with FFmpeg? I'm working on a method to programmatically remove video and subtitle streams from video files of various formats and have been having some trouble with most .wmv files. Below is what I believe to be the minimal command required for this:
ffmpeg -y -i a.wmv -c copy -map 0:a -map 0:d -vn -sn b.wmv
And here is the output I'm getting
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --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-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[wmv3 @ 0000024f26ba3ac0] Extra data: 8 bits left, value: 0
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'a.wmv':
  Metadata:
    copyright       : ChessBase GmbH
    WMFSDKVersion   : 12.0.9600.17415
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    DeviceConformanceTemplate: MP@ML
  Duration: 00:00:23.08, start: 0.000000, bitrate: 526 kb/s
    Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 96 kb/s
    Stream #0:1: Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x480, 415 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:2: Data: none, 10 kb/s
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #0:2 -&gt; #0:1 (copy)
    Last message repeated 1 times

When I try to specify either local_header or global_header, I get
[aac @ 00000297ccbac080] Qavg: nan
I tried to research it for quite a while, but since I don't really understand much of any of this, I didn't get any good leads.
What is this problem and how do I solve or work around it?
Apparently, I needed to specify pcm_s16le as the audio codec. Other files (not in the snippet from the question) where using aac, .wmv required me to specify otherwise.