ZeroDivisionError
AndreLYL opened this issue · 5 comments
How to solve this Problem?
i used pip not pip3 to install opencv-python and video-to-ascii because it is not work
Traceback (most recent call last):
File "/home/andre/anaconda3/bin/video-to-ascii", line 10, in
sys.exit(main())
File "/home/andre/anaconda3/lib/python3.7/site-packages/video_to_ascii/cli.py", line 21, in main
player.play(ARGS.file, strategy=ARGS.strategy, output=ARGS.output, play_audio=ARGS.with_audio)
File "/home/andre/anaconda3/lib/python3.7/site-packages/video_to_ascii/player.py", line 23, in play
engine.play(output)
File "/home/andre/anaconda3/lib/python3.7/site-packages/video_to_ascii/video_engine.py", line 38, in play
with_audio=self.with_audio)
File "/home/andre/anaconda3/lib/python3.7/site-packages/video_to_ascii/render_strategy/ascii_strategy.py", line 113, in render
time_delta = 1./fps
ZeroDivisionError: float division by zero
@AndreLYL I was checking the code and I found this line
time_delta = 1./fps
fps
get its value from cv2.CAP_PROP_FPS
, perhaps are you trying to use this tool with a image file instead of video file?
I have the same video, seems that cv2 can't get the FPS so it takes 0 as FPS, when I try setting the FPS manually it only echoes '
Same here, still not fixed
Same error here. I hope the following helps with your debug research:
1. System info
- Debian 10.7
python3
: 3.7.3pip3
: 18.1
2. Installations performed:
$ sudo apt install python3-pip
$ pip3 install video-to-ascii
$ pip3 install opencv-python
Because I had the same module error scenario, I installed opencv-python
as instructed here: #36
3. Command execution:
$ video-to-ascii -f 300-remix.mp4
4. Error dump:
Traceback (most recent call last):
File "/home/user/.local/bin/video-to-ascii", line 10, in <module>
sys.exit(main())
File "/home/user/.local/lib/python3.7/site-packages/video_to_ascii/cli.py", line 21, in main
player.play(ARGS.file, strategy=ARGS.strategy, output=ARGS.output, play_audio=ARGS.with_audio)
File "/home/user/.local/lib/python3.7/site-packages/video_to_ascii/player.py", line 23, in play
engine.play(output)
File "/home/user/.local/lib/python3.7/site-packages/video_to_ascii/video_engine.py", line 38, in play
with_audio=self.with_audio)
File "/home/user/.local/lib/python3.7/site-packages/video_to_ascii/render_strategy/ascii_strategy.py", line 113, in render
time_delta = 1./fps
ZeroDivisionError: float division by zero
5. ffprobe dump of used video file
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300-remix.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-11-13T21:50:55.000000Z
Duration: 00:03:13.38, start: 0.000000, bitrate: 614 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 516 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
creation_time : 2018-11-13T21:50:55.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/13/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2018-11-13T21:50:55.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/13/2018.
Solved with b089c5f