Created
March 31, 2022 13:08
-
-
Save Kenya-West/23bacf50a19a1fe65560f86fc9992ba1 to your computer and use it in GitHub Desktop.
Find vertical videos MP4 that has resolution smaller than 400 by height. This script uses TagLibSharp. Get it here first: https://www.nuget.org/packages/TagLibSharp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module "Path\To\TagLibSharp.dll"; | |
$dir = ".\"; | |
$files = Get-ChildItem -Path $dir -Filter "*.mp4"; | |
[array] $arr = @(); | |
function Format-CoubName { | |
param ( | |
[string]$Name | |
) | |
$shortName = $Name | Split-Path -LeafBase; | |
$result = "https://coub.com/view/$shortName" | |
return $result | |
} | |
$files | % { | |
# Console out file | |
# "$_.Name" | |
$video = [TagLib.File]::Create((Resolve-Path $_.Name)); | |
if ($video.MimeType -like "*mp4*") { | |
$props = $video.Properties | |
if (($props.VideoWidth -le $props.VideoHeight) -and ($props.VideoHeight -le 400)) { | |
$name = $video.Name | Split-Path -Leaf; | |
$arr += Format-CoubName($video.Name); | |
Write-Output "Added $name to downloads"; | |
} | |
} | |
} | |
$arr | Out-File ".\small-videos.txt" -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment