8000 Cannot open video for writing · Issue #25 · jeffffffli/NIKI · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Cannot open video for writing #25

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
XJX-187 opened this issue Apr 11, 2024 · 4 comments
Open

Cannot open video for writing #25

XJX-187 opened this issue Apr 11, 2024 · 4 comments

Comments

@XJX-187
Copy link
XJX-187 commented Apr 11, 2024

Env: Windows 10, anaconda 24.1 , python 3.8.19

sends the error:
Loading model from exp/checkpoint_49_cocoeft.pth...
Loding LGD model from exp/niki_model_28.pth
Try to use other video encoders...
Traceback (most recent call last):
File "scripts/demo.py", line 208, in
assert write_stream.isOpened(), 'Cannot open video for writing'
AssertionError: Cannot open video for writing

@XJX-187
Copy link
Author
XJX-187 commented Apr 11, 2024

now is:
Loading model from exp/checkpoint_49_cocoeft.pth...
Loding LGD model from exp/niki_model_28.pth
OpenCV: FFMPEG: tag 0x64697678/'xvid' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
Try to use other video encoders...
Traceback (most recent call last):
File "scripts/demo.py", line 208, in
assert write_stream.isOpened(), 'Cannot open video for writing'
AssertionError: Cannot open video for writing

@soltkreig
Copy link
soltkreig commented May 14, 2024

You can comment line 208 assert write_stream.isOpened(), 'Cannot open video for writing', but I got next error:

Could not find encoder for codec id 27: Encoder not found
Try to use other video encoders...
ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory
0it [00:00, ?it/s]
### Run Model...
0it [00:00, ?it/s]
pred_uvd  failed
pred_xyz_29  failed
pred_scores  failed
pred_sigma  failed
f  failed
pred_betas  failed
pred_phi  failed
scale_mult  failed
pred_cam_root  failed
bbox  failed
height  failed
width  failed
img_path  failed
img_sizes  failed
total_img 0
Traceback (most recent call last):
  File "scripts/demo.py", line 328, in <module>
    mean_beta = res_db['pred_betas'].mean(axis=0)
AttributeError: 'list' object has no attribute 'mean'

@XJX-187
Copy link
Author
XJX-187 commented May 16, 2024

You can comment line 208 assert write_stream.isOpened(), 'Cannot open video for writing', but I got next error:

Could not find encoder for codec id 27: Encoder not found
Try to use other video encoders...
ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory
0it [00:00, ?it/s]
### Run Model...
0it [00:00, ?it/s]
pred_uvd  failed
pred_xyz_29  failed
pred_scores  failed
pred_sigma  failed
f  failed
pred_betas  failed
pred_phi  failed
scale_mult  failed
pred_cam_root  failed
bbox  failed
height  failed
width  failed
img_path  failed
img_sizes  failed
total_img 0
Traceback (most recent call last):
  File "scripts/demo.py", line 328, in <module>
    mean_beta = res_db['pred_betas'].mean(axis=0)
AttributeError: 'list' object has no attribute 'mean'

Perhaps you should try reinstalling ffmpeg first, as I also installed H.246 at the time. Try to ensure that either pip or conda installs all packages.
Unfortunately, I also forgot which specific modifications were made at that time.Good Luck!

@soltkreig
Copy link
soltkreig commented May 16, 2024

Found the solution:
in scripts/demo.py
replace code from line 186 if you use full path for output folder, on:

savepath = f'{output}/res_{video_basename}.mp4'
savepath2d = f'{output}/res_2d_{video_basename}.mp4'

and 191 from:

write_stream = cv2.VideoWriter(
    *[info[k] for k in ['savepath', 'fourcc', 'fps', 'frameSize']])

to:

write_stream = cv2.VideoWriter(info['savepath'],  info['fourcc'], info['fps'], info['frameSize'])

and 426 line to:

res_db_path = os.path.join(f'{opt.out_dir}/', f'{video_basename}.pt')
joblib.dump(res_db, res_db_path)

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

No branches or pull requests

2 participants
0