Powershell バッチ ビデオ ファイルからオーディオを抽出するコマンド

Powershell バッチ ビデオ ファイルからオーディオを抽出するコマンド

現在のフォルダーにあるビデオのすべてのオーディオ トラックを再エンコードせずに抽出し、サブフォルダーに配置する bash コマンドが機能しています。

for f in *.mp4; do ffmpeg -i "$f" -vn -c:a copy ./audio/"${f%.*}".m4a; done

PS の同等のコマンドを見つけようとしています。どうすればいいでしょうか? 次のことを試してください:

ls *.mp4|foreach{
    ffmpeg -i $_ -vn -c:a copy $_.name.replace("mp4", "m4a")
}

Opus オーディオを含む一部のファイルでこのエラーが発生します:

[ipod @ 00000000005719c0] Could not find tag for codec opus in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --

ビデオ ファイル上のあらゆる形式のオーディオを抽出する方法はありますか? PS の bash コマンドの動作を模倣します。

ありがとう!

関連情報