browsertime 14.10.2 → 14.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/browsertime/visualmetrics.py +42 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 14.11.0 - 2021-11-23
|
|
4
|
+
### Fixed
|
|
5
|
+
* Use the viewport to determine if more cropping is needed in visual metrics. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1680](https://github.com/sitespeedio/browsertime/pull/1680).
|
|
6
|
+
### Added
|
|
7
|
+
* Updated to Selenium 4.1.0 [#1679](https://github.com/sitespeedio/browsertime/pull/1679)
|
|
3
8
|
|
|
4
9
|
## 14.10.2 - 2021-11-20
|
|
5
10
|
### Fixed
|
|
@@ -95,7 +95,7 @@ def video_to_frames(
|
|
|
95
95
|
os.mkdir(directory, 0o755)
|
|
96
96
|
if os.path.isdir(directory):
|
|
97
97
|
directory = os.path.realpath(directory)
|
|
98
|
-
viewport = find_video_viewport(
|
|
98
|
+
viewport, cropped = find_video_viewport(
|
|
99
99
|
video,
|
|
100
100
|
directory,
|
|
101
101
|
find_viewport,
|
|
@@ -122,12 +122,12 @@ def video_to_frames(
|
|
|
122
122
|
remove_orange_frames(dir, orange_file)
|
|
123
123
|
find_first_frame(dir, white_file)
|
|
124
124
|
blank_first_frame(dir)
|
|
125
|
-
find_render_start(dir, orange_file, gray_file)
|
|
125
|
+
find_render_start(dir, orange_file, gray_file, cropped)
|
|
126
126
|
find_last_frame(dir, white_file)
|
|
127
127
|
adjust_frame_times(dir)
|
|
128
128
|
if timeline_file is not None and not multiple:
|
|
129
129
|
synchronize_to_timeline(dir, timeline_file)
|
|
130
|
-
eliminate_duplicate_frames(dir)
|
|
130
|
+
eliminate_duplicate_frames(dir, cropped)
|
|
131
131
|
eliminate_similar_frames(dir)
|
|
132
132
|
# See if we are limiting the number of frames to keep
|
|
133
133
|
# (before processing them to save processing time)
|
|
@@ -374,6 +374,11 @@ def find_video_viewport(
|
|
|
374
374
|
):
|
|
375
375
|
logging.debug("Finding Video Viewport...")
|
|
376
376
|
viewport = None
|
|
377
|
+
|
|
378
|
+
# cropped will be True if the viewport setting changes
|
|
379
|
+
# the original frame
|
|
380
|
+
cropped = False
|
|
381
|
+
|
|
377
382
|
try:
|
|
378
383
|
from PIL import Image
|
|
379
384
|
|
|
@@ -461,12 +466,21 @@ def find_video_viewport(
|
|
|
461
466
|
viewport = find_image_viewport(frame)
|
|
462
467
|
else:
|
|
463
468
|
viewport = {"x": 0, "y": 0, "width": width, "height": height}
|
|
469
|
+
|
|
464
470
|
os.remove(frame)
|
|
465
471
|
|
|
472
|
+
if viewport is not None and viewport != {
|
|
473
|
+
"x": 0,
|
|
474
|
+
"y": 0,
|
|
475
|
+
"width": width,
|
|
476
|
+
"height": height,
|
|
477
|
+
}:
|
|
478
|
+
cropped = True
|
|
479
|
+
|
|
466
480
|
except Exception as e:
|
|
467
481
|
viewport = None
|
|
468
482
|
|
|
469
|
-
return viewport
|
|
483
|
+
return viewport, cropped
|
|
470
484
|
|
|
471
485
|
|
|
472
486
|
def trim_video_end(directory, trim_time):
|
|
@@ -615,7 +629,7 @@ def find_last_frame(directory, white_file):
|
|
|
615
629
|
logging.exception("Error finding last frame")
|
|
616
630
|
|
|
617
631
|
|
|
618
|
-
def find_render_start(directory, orange_file, gray_file):
|
|
632
|
+
def find_render_start(directory, orange_file, gray_file, cropped):
|
|
619
633
|
logging.debug("Finding Render Start...")
|
|
620
634
|
try:
|
|
621
635
|
if (
|
|
@@ -641,6 +655,10 @@ def find_render_start(directory, orange_file, gray_file):
|
|
|
641
655
|
mask["y"] = int(math.floor(height / 2 - mask["height"] / 2))
|
|
642
656
|
else:
|
|
643
657
|
mask = None
|
|
658
|
+
|
|
659
|
+
im_width = width
|
|
660
|
+
im_height = height
|
|
661
|
+
|
|
644
662
|
top = 10
|
|
645
663
|
right_margin = 10
|
|
646
664
|
bottom_margin = 24
|
|
@@ -660,6 +678,14 @@ def find_render_start(directory, orange_file, gray_file):
|
|
|
660
678
|
width = max(client_viewport["width"] - right_margin, 1)
|
|
661
679
|
left += client_viewport["x"]
|
|
662
680
|
top += client_viewport["y"]
|
|
681
|
+
elif cropped:
|
|
682
|
+
# The image was already cropped, so only cutout the bottom
|
|
683
|
+
# to get rid of the network request/etc. information
|
|
684
|
+
top = 0
|
|
685
|
+
left = 0
|
|
686
|
+
width = im_width
|
|
687
|
+
height = im_height - bottom_margin
|
|
688
|
+
|
|
663
689
|
crop = "{0:d}x{1:d}+{2:d}+{3:d}".format(width, height, left, top)
|
|
664
690
|
for i in range(1, count):
|
|
665
691
|
if frames_match(first, files[i], 10, 0, crop, mask):
|
|
@@ -679,7 +705,7 @@ def find_render_start(directory, orange_file, gray_file):
|
|
|
679
705
|
logging.exception("Error getting render start")
|
|
680
706
|
|
|
681
707
|
|
|
682
|
-
def eliminate_duplicate_frames(directory):
|
|
708
|
+
def eliminate_duplicate_frames(directory, cropped):
|
|
683
709
|
logging.debug("Eliminating Duplicate Frames...")
|
|
684
710
|
global client_viewport
|
|
685
711
|
try:
|
|
@@ -697,6 +723,9 @@ def eliminate_duplicate_frames(directory):
|
|
|
697
723
|
):
|
|
698
724
|
client_viewport = None
|
|
699
725
|
|
|
726
|
+
im_width = width
|
|
727
|
+
im_height = height
|
|
728
|
+
|
|
700
729
|
# Figure out the region of the image that we care about
|
|
701
730
|
top = 40
|
|
702
731
|
right_margin = 10
|
|
@@ -714,6 +743,13 @@ def eliminate_duplicate_frames(directory):
|
|
|
714
743
|
width = max(client_viewport["width"] - right_margin, 1)
|
|
715
744
|
left += client_viewport["x"]
|
|
716
745
|
top += client_viewport["y"]
|
|
746
|
+
elif cropped:
|
|
747
|
+
# The image was already cropped, so only cutout the bottom
|
|
748
|
+
# to get rid of the network request/etc. information
|
|
749
|
+
top = 0
|
|
750
|
+
left = 0
|
|
751
|
+
width = im_width
|
|
752
|
+
height = im_height - bottom_margin
|
|
717
753
|
|
|
718
754
|
crop = "{0:d}x{1:d}+{2:d}+{3:d}".format(width, height, left, top)
|
|
719
755
|
logging.debug("Viewport cropping set to " + crop)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.11.0",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@sitespeed.io/throttle": "3.0.0",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lodash.merge": "4.6.2",
|
|
23
23
|
"lodash.pick": "4.4.0",
|
|
24
24
|
"lodash.set": "4.3.2",
|
|
25
|
-
"selenium-webdriver": "4.
|
|
25
|
+
"selenium-webdriver": "4.1.0",
|
|
26
26
|
"@sitespeed.io/edgedriver": "95.0.1020-30",
|
|
27
27
|
"@sitespeed.io/geckodriver": "0.29.1-2",
|
|
28
28
|
"@sitespeed.io/tracium": "0.3.3",
|