AdamSpannbauer / python_video_stab

A Python package to stabilize videos using OpenCV
https://adamspannbauer.github.io/python_video_stab/html/index.html
MIT License
682 stars 118 forks source link

IndexError: pop from an empty deque #70

Closed bipindr123 closed 5 years ago

bipindr123 commented 5 years ago
/usr/local/lib/python3.6/dist-packages/vidstab/general_utils.py:57: UserWarning: No progress bar will be shown. (Unable to grab frame count & no max_frames provided.)
  warnings.warn('No progress bar will be shown. (Unable to grab frame count & no max_frames provided.)')
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/vidstab/__main__.py", line 64, in <module>
    cli_stabilizer(args)
  File "/usr/local/lib/python3.6/dist-packages/vidstab/main_utils.py", line 119, in cli_stabilizer
    playback=args['playback'])
  File "/usr/local/lib/python3.6/dist-packages/vidstab/VidStab.py", line 485, in stabilize
    bar = self._init_trajectory(smoothing_window, max_frames, show_progress=show_progress)
  File "/usr/local/lib/python3.6/dist-packages/vidstab/VidStab.py", line 157, in _init_trajectory
    self._process_first_frame()
  File "/usr/local/lib/python3.6/dist-packages/vidstab/VidStab.py", line 137, in _process_first_frame
    _, _ = self.frame_queue.read_frame(array=array)
  File "/usr/local/lib/python3.6/dist-packages/vidstab/frame_queue.py", line 43, in read_frame
    return self._append_frame(frame, pop_ind)
  File "/usr/local/lib/python3.6/dist-packages/vidstab/frame_queue.py", line 51, in _append_frame
    self.i = self.inds.popleft()
IndexError: pop from an empty deque

Works for some videos but for some videos it gives this error

AdamSpannbauer commented 5 years ago

Thanks for reporting the issue.

If possible, can you provide some more information for me to reproduce the error:

bipindr123 commented 5 years ago

Hi command used: python3 -m vidstab --input input_video.mov --output stable_video.avi I tried it on a bunch of videos I had, of which only 1 worked. I also tried it on a youtube video downloaded and it didnt seem to work. Also i tried converting the video to different formats and resolutions but to no avail. I am uploading one of the videos it failed on. https://drive.google.com/open?id=1TfexTs1XTY_un0YMfe67xU390IWGOGve

AdamSpannbauer commented 5 years ago

Thanks for providing the additional info.

What version of Python & vidstab are you running? I couldn't reproduce the error on my local machine (Mac) using Python 3.6.5, vidstab 1.6.0, and the video you linked.

bipindr123 commented 5 years ago

Hey I tried it again and it was a stupid error on my part of not being in the correct directory. (although it somehow worked one video) my bad, very sorry for wasting your time thank you for your time

AdamSpannbauer commented 5 years ago

Happy to help debug. Glad you figured it out.

AdamSpannbauer commented 5 years ago

This should be a more descriptive error message though. I've opened up #71 to avoid this confusing error message in the future.