Skip to content

Commit

Permalink
reduce lines
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Apr 11, 2021
1 parent 626a77e commit 92986c9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ def __init__(self, sources='streams.txt', img_size=640, stride=32):
if 'youtube.com/' in url or 'youtu.be/' in url:
check_requirements(file=None, include=('pafy', 'youtube_dl'))
import pafy
video = pafy.new(url)
best = video.getbest(preftype="mp4")
url = best.url
url = pafy.new(url).getbest(preftype="mp4").url
cap = cv2.VideoCapture(url)
assert cap.isOpened(), f'Failed to open {s}'
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
Expand Down

0 comments on commit 92986c9

Please sign in to comment.