我有一个视频目录(.AVI 文件),我想确定其持续时间,并创建一个文件列出所有视频的标题和持续时间,并按视频持续时间的降序排列。
任何人都可以提供 PowerShell 脚本来执行此操作吗?
谢谢,MagicAndi
最佳答案
基于 MagicAndi 的方法。
# Needs the path where your dll is
Add-Type -Path "C:\taglib-sharp.dll"
Function Get-VideoDetails {
param ($targetDirectory)
Get-ChildItem $targetDirectory -Include *.avi -Recurse -Force | ForEach {
$video = [TagLib.File]::Create($_.FullName)
New-Object PSObject -Property @{
Name = $_.FullName
Duration = $video.Properties.Duration.TotalMinutes
}
}
# Supply your video directory
Get-VideoDetails "C:\Videos" | Sort Duration -Descending
关于video - 使用 PowerShell 确定目录中视频的运行时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1987648/