如何使用FFmpeg從.wmv中刪除視頻流?


0

我正在研究一種以編程方式從各種格式的視頻文件中刪除視頻和字幕流的方法,並且在處理大多數.wmv文件時遇到了麻煩。我認為這是為此所需的最小命令:

ffmpeg -y -i a.wmv -c copy -map 0:a -map 0:d -vn -sn b.wmv

這是我得到的輸出

  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: [email protected]
  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

當我嘗試指定local_headerglobal_header時,我得到

[aac @ 00000297ccbac080] Qavg: nan

我嘗試研究了很長時間,但是由於我對這方面的知識並不太了解,因此沒有任何好的線索。

這是什麼問題,我該如何解決或解決?

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.