Answers.Body: <p>Apparently, I needed to specify <code>pcm_s16le</code> as the audio codec. Other files (not in the snippet from the question) where using <code>aac</code>, .wmv required me to specify otherwise.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-02T20:04:36.853Z
Answers.LastActivityDate: 2020-07-02T20:04:36.853Z
Answers.UserDisplayName: Fabio Freitas
Body: <p>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:</p>
  <p><code>ffmpeg -y -i a.wmv -c copy -map 0:a -map 0:d -vn -sn b.wmv</code></p>
  <p>And here is the output I'm getting</p>
  <pre><code>  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
  </code></pre>
  <p>When I try to specify either <code>local_header</code> or <code>global_header</code>, I get</p>
  <p><code>[aac @ 00000297ccbac080] Qavg: nan</code></p>
  <p>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.</p>
  <p>What is this problem and how do I solve or work around it?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-02T09:33:39.320Z
Comments.Text: Likely due to the data stream. Confirm by removing 0:d map.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-02T12:37:15.413Z
Comments.Text: Then I get `[aac @ 0000024da6382340] Queue input is backward in time
  [asf @ 0000024da6381000] Non-monotonous DTS in output stream 0:0` and the file won't render! Is there a way to specify reencoding of the data stream or something?
Comments.UserDisplayName: Fabio Freitas
Tags: <ffmpeg><file-formats><software>
Title: How to remove video streams from .wmv with FFmpeg?
UserDisplayName: Fabio Freitas
ThreadText: # How to remove video streams from .wmv with FFmpeg?
  
  (Asked by: username_0 on 2020-07-02)
  
  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 -> #0:0 (copy)
    Stream #0:2 -> #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?
  
  **Tags:** ffmpeg, file-formats, software
  
  > **Comments:**
  > **username_1**: Likely due to the data stream. Confirm by removing 0:d map.  
  > **username_0**: Then I get `[aac @ 0000024da6382340] Queue input is backward in time [asf @ 0000024da6381000] Non-monotonous DTS in output stream 0:0` and the file won't render! Is there a way to specify reencoding of the data stream or something?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-07-02. Score: 0
  
  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.
  
  
  ---
  
  