Skip to content

Commit 424bc41

Browse files
authored
Fix video 'pred_only' issue
1 parent 3f5fe63 commit 424bc41

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ python run.py --encoder vitl --img-path assets/examples --outdir depth_vis
8282
**If you want to use Depth Anything V2 on videos:**
8383

8484
```bash
85-
python run_video.py --encoder vitl --video-path assets/examples_video --outdir video_depth_vis
85+
python run_video.py --encoder <vits | vitb | vitl> --video-path assets/examples_video --outdir video_depth_vis [--input-size <size>] [--pred-only] [--grayscale]
8686
```
8787

8888
*Please note that our larger model has better temporal consistency on videos.*

run_video.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
raw_video = cv2.VideoCapture(filename)
5757
frame_width, frame_height = int(raw_video.get(cv2.CAP_PROP_FRAME_WIDTH)), int(raw_video.get(cv2.CAP_PROP_FRAME_HEIGHT))
5858
frame_rate = int(raw_video.get(cv2.CAP_PROP_FPS))
59-
output_width = frame_width * 2 + margin_width
59+
60+
if args.pred_only:
61+
output_width = frame_width
62+
else:
63+
output_width = frame_width * 2 + margin_width
6064

6165
output_path = os.path.join(args.outdir, os.path.splitext(os.path.basename(filename))[0] + '.mp4')
6266
out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"mp4v"), frame_rate, (output_width, frame_height))

0 commit comments

Comments
 (0)