Scale videos properly. Previously there was an issue with vertical
or squared videos bigger than 720 pixels high. Also sets timestamp for videoCreateDate even if nothing is found. Done to avoid cache corruption when walking the albums.
This commit is contained in:
parent
5cbc3f31e3
commit
6029f92aad
@ -278,7 +278,11 @@ class Photo(object):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# use time from EXIF (rather than file creation)
|
# use time from EXIF (rather than file creation)
|
||||||
if info['format']['tags']['creation_time']:
|
try:
|
||||||
|
info['format']['tags']['creation_time']
|
||||||
|
except KeyError:
|
||||||
|
self._attributes["videoCreateDate"] = self._attributes["dateTimeFile"]
|
||||||
|
else:
|
||||||
# we have time modifiable via exif
|
# we have time modifiable via exif
|
||||||
# lets use this
|
# lets use this
|
||||||
|
|
||||||
@ -470,9 +474,19 @@ class Photo(object):
|
|||||||
if os.path.exists(transcode_path) and file_mtime(transcode_path) >= self._attributes["dateTimeFile"]:
|
if os.path.exists(transcode_path) and file_mtime(transcode_path) >= self._attributes["dateTimeFile"]:
|
||||||
self._video_metadata(transcode_path, False)
|
self._video_metadata(transcode_path, False)
|
||||||
return
|
return
|
||||||
if "originalSize" in self._attributes and self._attributes["originalSize"][1] > 720:
|
if "originalSize" in self._attributes:
|
||||||
transcode_cmd.append('-s')
|
width = self._attributes["originalSize"][0]
|
||||||
transcode_cmd.append('hd720')
|
height = self._attributes["originalSize"][1]
|
||||||
|
if width > height:
|
||||||
|
# horisontal orientation
|
||||||
|
if height > 720:
|
||||||
|
transcode_cmd.append('-vf')
|
||||||
|
transcode_cmd.append('scale=-1:720')
|
||||||
|
elif (height > width) or (width == height):
|
||||||
|
# vertical orientation, or equal sides
|
||||||
|
if width > 720:
|
||||||
|
transcode_cmd.append('-vf')
|
||||||
|
transcode_cmd.append('scale=720:-1')
|
||||||
if "rotate" in self._attributes:
|
if "rotate" in self._attributes:
|
||||||
if self._attributes["rotate"] == "90":
|
if self._attributes["rotate"] == "90":
|
||||||
filters.append('transpose=1')
|
filters.append('transpose=1')
|
||||||
|
Loading…
Reference in New Issue
Block a user