是不是会从油管载几个音乐视频,为了方便转换为MP3,在Win10试了PowerShell,尚未完全批处理,分为步骤如下: 1. 搜集目录下近期下载的MV文件列表 ``` # List input file name Get-ChildItem -Path I:\YOUGET\MusicVideos\*.mp4 | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-30) } | Select Name ``` 2. 自定义输出的MP3文件名,将其与对应的输入文件名一起存放到一个字符串中,稍后转换为一个Hashtable结构。 ``` # Construct a hashtable, using Output MP3 name as key, and input file name as Value. $nmapping=@" mp3-file1 = ... mp3-file2 = ... mp3-file3 = ... "@ $hash = ConvertFrom-StringData $nmapping ``` 3. 遍历Hashtable的元素,执行 ffmpeg 命令来转换为MP3。 ``` # Loop the hash table, and run ffmpeg foreach ($h in $hash.GetEnumerator()) { $InputFileName = "I:\YOUGET\MusicVideos\" + "$($h.Value)" $OutputFileName = "I:\YOUGET\MP3\" + "$($h.Name)" + ".MP3" Write-Host "Convertign $InputFileName to $OutputFileName ..." ffmpeg -i "$InputFileName" -vn -ab 256k "$OutputFileName" } ``` 参考了以...