ゆっくりMovieMaker4βで、指定のフォルダ下にある画像ファイルをタイムライン上に横並びのymmpファイルを出力するPowerShellスクリプトを作成しました。
#
# YMM4のymmpファイルをさくせいする。
#
using namespace System.Drawing
Param(
[String]$targetDir="画像を置いてあるフォルダ",
[String]$ymmpPath="出力する.ymmpのパス"
)
Add-Type -AssemblyName System.Drawing
$defaultLength = 6000
$currentFrame = 0
$moveWidth = 3840
$moveHeight = 2160
$data = [PSCustomObject]@{
Timeline = [PSCustomObject]@{
VideoInfo = [PSCustomObject]@{
"FPS" = 60
"Hz" = 48000
"Width" = $moveWidth
"Height" = $moveHeight
}
"Items" = [PSCustomObject]@()
"LayerVisibilities" = [PSCustomObject]@{
"HiddenLayers" = @()
}
"CurrentFrame" = 0
"Length" = 1
"MaxLayer" = 0
}
"Characters" = @()
}
Get-ChildItem -LiteralPath $targetDir -Filter "*.png" | % {
$bmp = [Bitmap]::FromFile($_.FullName)
$Width = $bmp.Width
$Height = $bmp.Height
$bmp.Dispose()
$scale = [double]$moveWidth / [double]$Width
$data.Timeline.Items +=
[PSCustomObject]@{
'$type'="YukkuriMovieMaker.Project.Items.ImageItem, YukkuriMovieMaker"
"FilePath"=$_.FullName
"X" = [PSCustomObject]@{
"From" = 0.0
"To" = 0.0
"AnimationType" = "なし"
"Span" = 0.0
}
"Y" = [PSCustomObject]@{
"From" = 0.0
"To" = 0.0
"AnimationType" = "なし"
"Span" = 0.0
}
"Opacity" = [PSCustomObject]@{
"From" = 100.0
"To" = 0.0
"AnimationType" = "なし"
"Span" = 0.0
}
"Zoom" = [PSCustomObject]@{
"From" = $scale * 100.0
"To" = 0.0
"AnimationType" = "なし"
"Span" = 0.0
}
"Rotation" = [PSCustomObject]@{
"From" = 0.0
"To" = 0.0
"AnimationType" = "なし"
"Span" = 0.0
}
"FadeIn" = 0.0
"FadeOut" = 0.0
"Blend" = "Normal"
"IsInverted" = $false
"IsAlwaysOnTop" = $false
"VideoEffects" = @()
"Group" = 0
"Frame" = $currentFrame
"Layer" = 0
"Length" = $defaultLength
"PlaybackRate" = 100.0
"ContentOffset" = "00:00:00"
"IsLocked" = $false
"IsHidden" = $false
}
$currentFrame += $defaultLength
}
$max = ($data.Timeline.Items | % { $_.Frame } | measure-object -maximum).Maximum
$len = ($data.Timeline.Items | ? { $_.Frame -eq $max }).Length
$data.Timeline.Length = $max + $len
$data.Timeline.MaxLayer = ($data.Timeline.Items | % { $_.Layer } | measure-object -maximum).Maximum
$data | ConvertTo-Json -Depth 4 | Set-Content -LiteralPath $ymmpPath -Encoding UTF8
以前ゆっくりMovieMaker3でも同じ目的のスクリプトを作成しました.
ゆっくりMovieMaker3の.ymmpはXML形式でしたが、ゆっくりMovieMaker4βの.ymmpはjson形式でしたので互換性はないです。
.ymmpを新規に作成する作りなっています。
コメント