-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Claude/loving lamport 5 st6 m #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blofi
wants to merge
4
commits into
browser-use:main
Choose a base branch
from
blofi:claude/loving-lamport-5ST6M
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,838
−14
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
350c435
Add uv.lock generated during video-use install
claude c3030f9
Add --vertical flag to render.py for 9:16 pan-and-scan output
claude 42dcbae
Add intelligent vertical pan-and-scan and DaVinci Resolve export package
claude c7637a8
Switch resolve export to ProRes 422 HQ, frame-based handles, folder o…
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,12 +157,17 @@ def extract_segment( | |
| out_path: Path, | ||
| preview: bool = False, | ||
| draft: bool = False, | ||
| vertical: bool = False, | ||
| ) -> None: | ||
| """Extract a cut range as its own MP4 with grade + 30ms audio fades baked in. | ||
|
|
||
| `-ss` before `-i` for fast accurate seeking. Scale to 1080p from 4K. | ||
| Portrait sources (height > width) are scaled by height to preserve orientation. | ||
|
|
||
| With vertical=True, output is 1080×1920 (9:16) — landscape sources are scaled | ||
| to height 1920 then centre-cropped to 1080 wide. Portrait sources are already | ||
| the right orientation and just scale normally to 1080×1920. | ||
|
|
||
| Quality ladder: | ||
| - final (default): 1080p libx264 fast CRF 20 | ||
| - preview: 1080p libx264 medium CRF 22 (evaluable for QC) | ||
|
|
@@ -171,15 +176,30 @@ def extract_segment( | |
| out_path.parent.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| portrait = is_portrait_source(source) | ||
| if draft: | ||
| scale = "scale=-2:1280" if portrait else "scale=1280:-2" | ||
|
|
||
| if vertical and not portrait: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Vertical mode does not enforce fixed 9:16 dimensions for portrait inputs, which can cause downstream concat-copy failures due to mixed segment resolutions. Prompt for AI agents |
||
| # Landscape → 9:16: scale to target height (making it wider than needed), | ||
| # then centre-crop to the target width. Default crop x centres automatically. | ||
| if draft: | ||
| scale = "scale=-2:1280" | ||
| crop = "crop=720:1280" | ||
| else: | ||
| scale = "scale=-2:1920" | ||
| crop = "crop=1080:1920" | ||
| else: | ||
| scale = "scale=-2:1920" if portrait else "scale=1920:-2" | ||
| # Normal horizontal output (or portrait source staying portrait). | ||
| if draft: | ||
| scale = "scale=-2:1280" if portrait else "scale=1280:-2" | ||
| else: | ||
| scale = "scale=-2:1920" if portrait else "scale=1920:-2" | ||
| crop = "" | ||
|
|
||
| vf_parts: list[str] = [] | ||
| if is_hdr_source(source): | ||
| vf_parts.append(TONEMAP_CHAIN) | ||
| vf_parts.append(scale) | ||
| if crop: | ||
| vf_parts.append(crop) | ||
| if grade_filter: | ||
| vf_parts.append(grade_filter) | ||
| vf = ",".join(vf_parts) | ||
|
|
@@ -216,6 +236,7 @@ def extract_all_segments( | |
| edit_dir: Path, | ||
| preview: bool, | ||
| draft: bool = False, | ||
| vertical: bool = False, | ||
| ) -> list[Path]: | ||
| """Extract every EDL range into edit_dir/clips_graded/seg_NN.mp4. | ||
| Returns the ordered list of segment paths. | ||
|
|
@@ -226,8 +247,9 @@ def extract_all_segments( | |
| """ | ||
| resolved = resolve_grade_filter(edl.get("grade")) | ||
| is_auto = resolved == "__AUTO__" | ||
| suffix = "_vertical" if vertical else "" | ||
| clips_dir = edit_dir / ( | ||
| "clips_draft" if draft else ("clips_preview" if preview else "clips_graded") | ||
| f"clips_draft{suffix}" if draft else (f"clips_preview{suffix}" if preview else f"clips_graded{suffix}") | ||
| ) | ||
| clips_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
|
|
@@ -255,7 +277,7 @@ def extract_all_segments( | |
| print(f" [{i:02d}] {src_name} {start:7.2f}-{end:7.2f} ({duration:5.2f}s) {note}") | ||
| if is_auto: | ||
| print(f" grade: {seg_filter or '(none)'}") | ||
| extract_segment(src_path, start, duration, seg_filter, out_path, preview=preview, draft=draft) | ||
| extract_segment(src_path, start, duration, seg_filter, out_path, preview=preview, draft=draft, vertical=vertical) | ||
| seg_paths.append(out_path) | ||
|
|
||
| return seg_paths | ||
|
|
@@ -601,6 +623,16 @@ def main() -> None: | |
| action="store_true", | ||
| help="Skip audio loudness normalization. Default is on (-14 LUFS, -1 dBTP, LRA 11).", | ||
| ) | ||
| ap.add_argument( | ||
| "--vertical", | ||
| action="store_true", | ||
| help=( | ||
| "Output 9:16 vertical video (1080×1920) for Reels / TikTok / Shorts. " | ||
| "Landscape sources are scaled to height 1920 then centre-cropped to 1080 wide. " | ||
| "Portrait sources are left as-is. Clips land in clips_graded_vertical/ " | ||
| "so horizontal and vertical renders can coexist in the same edit dir." | ||
| ), | ||
| ) | ||
| args = ap.parse_args() | ||
|
|
||
| edl_path = args.edl.resolve() | ||
|
|
@@ -613,16 +645,17 @@ def main() -> None: | |
|
|
||
| # 1. Extract per-segment (auto-grade per range if EDL grade is "auto") | ||
| segment_paths = extract_all_segments( | ||
| edl, edit_dir, preview=args.preview, draft=args.draft | ||
| edl, edit_dir, preview=args.preview, draft=args.draft, vertical=args.vertical | ||
| ) | ||
|
|
||
| # 2. Concat → base | ||
| v_suffix = "_vertical" if args.vertical else "" | ||
| if args.draft: | ||
| base_name = "base_draft.mp4" | ||
| base_name = f"base_draft{v_suffix}.mp4" | ||
| elif args.preview: | ||
| base_name = "base_preview.mp4" | ||
| base_name = f"base_preview{v_suffix}.mp4" | ||
| else: | ||
| base_name = "base.mp4" | ||
| base_name = f"base{v_suffix}.mp4" | ||
| base_path = edit_dir / base_name | ||
| concat_segments(segment_paths, base_path, edit_dir) | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Documentation inconsistency:
clips_graded_vertical/output directory introduced inrender.pydescription but missing from canonical 'Directory layout' section.Prompt for AI agents