Initial version, not so dynamic
This commit is contained in:
17
PictureFetcher.ps1
Normal file
17
PictureFetcher.ps1
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# PictureFetcher.ps1
|
||||||
|
# Connects to the cameras and downloads the current picture
|
||||||
|
|
||||||
|
$storageDir = "\\Megabyte.home.zyrex.org\Vault\Vault\Upload\Webcam\Timelapse\"
|
||||||
|
|
||||||
|
$urlTunet = "http://172.17.50.221/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=snapshot&password=snapshot"
|
||||||
|
$urlGaardsplass = "http://172.17.50.220/ISAPI/Streaming/channels/101/picture"
|
||||||
|
|
||||||
|
$fileTunet = "$storageDir\Tunet_$(Get-Date -Format "yyyyMMdd_HH-mm-ss").jpg"
|
||||||
|
$fileGaardsplass = "$storageDir\Gaardsplass_$(Get-Date -Format "yyyyMMdd_HH-mm-ss").jpg"
|
||||||
|
|
||||||
|
|
||||||
|
$webclient = New-Object System.Net.WebClient
|
||||||
|
$webclient.DownloadFile($urlTunet,$fileTunet)
|
||||||
|
|
||||||
|
$webclient.Credentials = new-object System.Net.NetworkCredential('snapshot', 'Snapshot')
|
||||||
|
$webclient.DownloadFile($urlGaardsplass,$fileGaardsplass)
|
||||||
40
TimelapseGenerator.ps1
Normal file
40
TimelapseGenerator.ps1
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# TimelapseGenerator.ps1
|
||||||
|
# Generates a customizable timelapse
|
||||||
|
|
||||||
|
$Camera = "Skiakersgutua"
|
||||||
|
$Style = "Monthly"
|
||||||
|
|
||||||
|
if ($Style -eq "Monthly") {
|
||||||
|
$Rate = "2"
|
||||||
|
}
|
||||||
|
else { $Rate = "10"}
|
||||||
|
|
||||||
|
|
||||||
|
$TempProcessingDir = "C:\Temp\AutoTimelapse\" # Photos are copied here for temporary processing
|
||||||
|
$TimelapsePhotoSrc = "\\megabyte.home.zyrex.org\Vault\Vault\Upload\Webcam\Timelapse\" # Here lies all the photos
|
||||||
|
$CompletedTimelapseDir = "\\megabyte.home.zyrex.org\Mediavault\Privat\Timelapses\"
|
||||||
|
|
||||||
|
# Get Current Month
|
||||||
|
$MonthCur = Get-Date -Format MM
|
||||||
|
# Get Last month
|
||||||
|
$MonthProcess = $MonthCur - 1
|
||||||
|
|
||||||
|
|
||||||
|
# Copy photos to correct folder
|
||||||
|
$photos = Get-ChildItem $TimelapsePhotoSrc
|
||||||
|
$Copyphotos = $photos | Where-Object {$_.name -Like "$($Camera)_????$($MonthProcess)??_12-00-??.jpg"}
|
||||||
|
|
||||||
|
foreach ($lapse in $Copyphotos) {
|
||||||
|
Copy-Item $lapse.fullname $TempProcessingDir\
|
||||||
|
}
|
||||||
|
# Rename photos
|
||||||
|
$i = 1
|
||||||
|
Get-ChildItem $TempProcessingDir | Sort-Object | ForEach-Object { Rename-Item $_.FullName -NewName ("$($Camera)_{0:D5}.jpg" -f $i++) }
|
||||||
|
|
||||||
|
# Make timelapse
|
||||||
|
# -crf bestemmer kvalitet. 20 er default, 51 er dårligst
|
||||||
|
# første -r er fin på 10 for kjapp timelapse, -r 5 er fin for litt roligere. andre -r kan være 30 eller 25? (Quick 25, normal 10)
|
||||||
|
& "./ffmpeg.exe" -r $rate -i "$tempProcessingDir\$($Camera)_%05d.jpg" -s hd1080 -c:v libx264 -r 30 -pix_fmt yuv420p -preset slow -crf 20 \\megabyte.home.zyrex.org\Mediavault\Privat\Timelapses\Gaardsplass_2020-$MonthProcess.mkv
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
Remove-Item $TempProcessingDir\* -Force
|
||||||
BIN
ffmpeg.exe
Normal file
BIN
ffmpeg.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user