Skip to content

fix(pexels_video): select widest file when API returns quality: null - #972

Open
gauravchahal20 wants to merge 13 commits into
OpenMontageInc:mainfrom
gauravchahal20:fix/issue-967-pexels-quality-null-fallback
Open

gauravchahal20 wants to merge 13 commits into
OpenMontageInc:mainfrom
gauravchahal20:fix/issue-967-pexels-quality-null-fallback

Conversation

@gauravchahal20

Copy link
Copy Markdown

Fixes #967

Description

Newer Pexels videos return quality: null on all entries of video_files. Previously, PexelsVideo.execute attempted to match vf.get('quality') == preferred_quality, which failed on null and fell back to video_files[0] (the raw API list's lowest resolution rendition, typically 360x640).

Changes

  • Sort video_files by width descending into sorted_files before searching for quality tags.
  • If no file explicitly matches preferred_quality:
    • When preferred_quality == 'hd' (the default): fall back to sorted_files[0] (the widest rendition).
    • When preferred_quality == 'sd': prefer renditions under 720p (standard definition: 540p, 480p, 360p), falling back to the lowest resolution file if none are below 720p.
  • Added comprehensive unit tests in tests/tools/test_pexels_video.py covering null-quality fallbacks, explicit quality matching, and error handling.

Verification

  • pytest tests/tools/test_pexels_video.py (5 passed)
  • pytest tests/tools/test_stock_source_adapters.py tests/tools/test_stock_provider_detection.py tests/tools/test_stock_source_stable_id.py (77 passed, 4 skipped)

…udio file with Veo and Flow-style continuity
…early

When playbackRate is set, Remotion's <OffthreadVideo> inner Sequence uses
trimAfter directly as timeline frames without dividing by playbackRate,
causing slow-motion clips (speed < 1) to stop early and render black for the
rest of the scene. The parent scene Sequence already bounds the clip's
lifetime, so omitting trimAfter when playbackRate is modified allows the
video to play smoothly through the entire scene duration.

Fixes OpenMontageInc#855
When running python from a virtual environment without activating the venv,
piper binary resides in the venv's bin/Scripts directory and is not on PATH.
Resolving piper next to sys.executable before falling back to PATH ensures
PiperTTS reports AVAILABLE and executes successfully.

Fixes OpenMontageInc#888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pexels_video downloads 360p when Pexels returns quality: null on video_files

1 participant