Compare commits

...

2 Commits

Author SHA1 Message Date
1MalcolmS
63e08eeddc image to video conversion implemented 2026-03-27 13:52:45 -07:00
1MalcolmS
5eec744d13 image to video conversion functional 2026-03-27 13:51:24 -07:00
4 changed files with 41 additions and 54 deletions

View File

@@ -1,4 +1,3 @@
ffmpeg -f image2 -framerate 2 -i %*.jpg -c:v libx265 video.mp4
#only works in wsl
ffmpeg -f image2 -framerate 2 -i image%04d.jpg -c:v libx265 video.mp4
will update to work for all at once

View File

@@ -1,19 +0,0 @@
#testing retreivable images
import requests
from time import time
headerz = { 'Referer' :
'https://www.portvancouver.com/' }
milliseconds = int(time() * 1000)
while True:
x = requests.get("https://ehub.portvancouver.com/Webcams/Photos/PortsideNo8?" + str(milliseconds), headers=headerz)
image_name = "image" + str(milliseconds) + ".jpg"
milliseconds -= 20000
if x.status_code == 200:
with open(image_name, 'wb') as f:
f.write(x.content)
print(x.status_code)

View File

@@ -1,32 +0,0 @@
import requests
from time import time
from time import sleep
from contextlib import chdir
import copy
headerz = {'Accept' : 'image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5', 'Accept-Encoding' :
'gzip, deflate, br, zstd', 'Accept-Language' :
'en-CA,en-US;q=0.9,en;q=0.8', 'Referer' :
'https://www.portvancouver.com/' }
milliseconds = int(time() * 1000)
image_check = requests.get("https://ehub.portvancouver.com/Photos/CPCTruckRoute?" + str(milliseconds))
print(image_check)
while True:
milliseconds = int(time() * 1000)
str1 = "https://ehub.portvancouver.com/Photos/CPCTruckRoute?" + str(milliseconds)
image_name = "image" + str(milliseconds) + ".jpg"
x1 = requests.get(str1, headers=headerz)
if x1.content != image_check.content:
if x1.status_code == 200:
with open(image_name, 'wb') as f:
f.write(x1.content)
else:
print("Copy detected and removed (x1)")
image_check = copy.deepcopy(x1)

39
videos.txt Normal file
View File

@@ -0,0 +1,39 @@
import subprocess
import os
video = ["Centerm in gate - videos", "Clark Drive overpass - videos", "Columbia Container - crossing - videos",
"Commissioner entrance - videos", "Commissioner street overpass - videos", "Commissioner truck staging - videos",
"Delta truck staging - videos", "Deltaport causeway - videos", "Deltaport gate 1 - videos",
"Fraser Surrey in gate - videos", "Fraser Surrey main intersection - videos", "Fraser Surrey track crossing - videos",
"Fraser Surrey VACS gates - videos", "Portside road - westbound - videos", "PortsideBlundellNo.8 road intersection - videos",
"Terminal dock - videos", "Vanterm Alliance Grain Terminal crossing - videos", "Vanterm in gate - videos",
"Waterfront_road Centerm crossing - videos"]
folder = ["Centerm in gate", "Clark Drive overpass", "Columbia Container - crossing",
"Commissioner entrance", "Commissioner street overpass", "Commissioner truck staging",
"Delta truck staging", "Deltaport causeway", "Deltaport gate 1",
"Fraser Surrey in gate", "Fraser Surrey main intersection", "Fraser Surrey track crossing",
"Fraser Surrey VACS gates", "Portside road - westbound", "PortsideBlundellNo.8 road intersection",
"Terminal dock", "Vanterm Alliance Grain Terminal crossing", "Vanterm in gate", "Waterfront_road Centerm crossing"]
folderpair = list(zip(video, folder))
print(folderpair)
#increment video number
def imageToVideo(folder_name, videopath):
v = os.path.join("..", "Videos", videopath, "video.mp4")
v = str(v)
os.chdir(folder_name)
subprocess.run(["ffmpeg",
"-f", "image2",
"-framerate", "2",
"-i", "image%04d.jpg",
"-c:v", "libx265",
v])
os.chdir("..")
for pair in folderpair:
imageToVideo(pair[1], pair[0])