video - 使用 PowerShell 确定目录中视频的运行时间

标签 video powershell scripting media

我有一个视频目录(.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/

相关文章:

python - 写入错误 : Broken pipe

css - 合并表格中的单元格?

android - 如何在android中使用 'Dropbox API'进行流媒体视频?

powershell - 如何在powershell中将字符串转换为十进制?

bash - 在 bash 脚本中使用 .env 属性

c# - ScintillaNET vs AvalonEdit 为 WPF 应用程序提供脚本接口(interface)

c++ - ffmpeg编码过程运行时更新参数

html - FFMPEG:从网络摄像头创建连续视频

powershell - 如何在 powershell 循环中使用数组键?

powershell - PowerShell字符串格式在函数内的不同行为