Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CV_Studio.spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ hiddenimports += collect_submodules('numpy')
hiddenimports += collect_submodules('librosa')
hiddenimports += collect_submodules('soundfile')
hiddenimports += collect_submodules('matplotlib')
hiddenimports += collect_submodules('pafy')
hiddenimports += collect_submodules('youtube_dl')
hiddenimports += collect_submodules('yt_dlp')
hiddenimports += collect_submodules('filterpy')
Expand Down Expand Up @@ -68,7 +67,6 @@ hiddenimports += [
'src.utils.logging',
'src.utils.gpu_utils',
'src.core',
'pafy',
'youtube_dl',
'yt_dlp',
'filterpy',
Expand Down
2 changes: 0 additions & 2 deletions build_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def generate_spec_file():
hiddenimports += collect_submodules('librosa')
hiddenimports += collect_submodules('soundfile')
hiddenimports += collect_submodules('matplotlib')
hiddenimports += collect_submodules('pafy')
hiddenimports += collect_submodules('youtube_dl')
hiddenimports += collect_submodules('yt_dlp')
hiddenimports += collect_submodules('filterpy')
Expand Down Expand Up @@ -232,7 +231,6 @@ def generate_spec_file():
'src.utils.logging',
'src.utils.gpu_utils',
'src.core',
'pafy',
'youtube_dl',
'yt_dlp',
'filterpy',
Expand Down
27 changes: 22 additions & 5 deletions node/InputNode/node_webrtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import time

import cv2
import pafy
import numpy as np
import dearpygui.dearpygui as dpg
import yt_dlp

from node_editor.util import dpg_get_value, dpg_set_value

Expand Down Expand Up @@ -384,10 +384,27 @@ def _button(self, sender, data, user_data):
dpg.set_item_label(tag_node_button_value_name,
self._loading_label)

pafy_video = pafy.new(youtube_url)
pafy_best_video = pafy_video.getbest(preftype="mp4")
youtube_capture = YoutubeCapture(pafy_best_video.url)
self._youtube_capture[youtube_url] = youtube_capture
# Use yt-dlp to get the best video URL
ydl_opts = {
'quiet': True,
'format': 'best[ext=mp4]/best', # Prefer MP4, fallback to best available
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(youtube_url, download=False)
video_url = info.get('url', None)
if not video_url:
raise ValueError("No video URL found")
youtube_capture = YoutubeCapture(video_url)
self._youtube_capture[youtube_url] = youtube_capture
except yt_dlp.utils.DownloadError as e:
print(f"Error downloading video info: {e}")
dpg.set_item_label(tag_node_button_value_name, self._start_label)
return
except Exception as e:
print(f"Unexpected error extracting video URL: {e}")
dpg.set_item_label(tag_node_button_value_name, self._start_label)
return

dpg.set_item_label(tag_node_button_value_name,
self._stop_label)
Expand Down
1 change: 0 additions & 1 deletion node/InputNode/node_youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from threading import Lock

import cv2
import pafy
import numpy as np
import dearpygui.dearpygui as dpg
import yt_dlp
Expand Down
1 change: 0 additions & 1 deletion node/StatsNode/node_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time

import cv2
import pafy
import numpy as np
import dearpygui.dearpygui as dpg

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dearpygui>=1.11.0
mediapipe
protobuf>=3.20.0
filterpy>=1.4.5
pafy
ffmpeg-python
serial
pytest
Expand Down