.. _troubleshooting: Troubleshooting =============== The first stop in any troubleshooting should always be to review logs. Whether you understand everything you read or barely a word, it will give you at least a few key words to start searching with. Inspect ffmpeg -------------- With ``loglevel`` set to ``DEBUG`` in ``config.yml``, the constructed ffmpeg will be logged, prefixed with: ``Constructed ffmpeg command``: .. code-block:: sh echo 'loglevel: DEBUG' >>config.yml python3 -m apr -a monitor DEBUG:Constructed ffmpeg command: ffmpeg -y -loglevel error -nostdin -nostats -f v4l2 -video_size 1920x1080 -framerate 5 -thread_queue_size 1024 -i /dev/video0 -f alsa -thread_queue_size 1024 -i hw:CARD=Generic_1,DEV=0 -vf drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf:text="%{localtime}":fontcolor=red@0.8:x=7:y=7 -preset medium -t 00:01:30 Simply copy/paste, add ``filename.mkv`` to the end. Python Debugger --------------- When threading is not a concern, pudb is the absolute best python debugger. Replace ``python3`` with ``pudb3`` to use: .. code-block:: sh pudb3 -m apr -a monitor Pip Space --------- If ``pip install`` runs out of space, the following error will be encountered: .. code-block:: text raise ProtocolError("Connection broken: %r" % e, e) pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: OSError(28, 'No space left on device')", OSError(28, 'No space left on device')) This can be resolved by telling pip to use a different build directory: .. code-block:: sh mkdir '../piptmp' TMPDIR='../piptmp' pip install '[...]' Log Noise --------- APR Review can produce a lot of log output when reviewing videos: .. code-block:: sh Input #0, wav, from '/tmp/tmpy3th2041.wav': 0KB sq= 0B f=0/0 Duration: 00:00:01.10, bitrate: 1536 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s 1.02 M-A: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 This noise is generated by a default log level showing playback status of each 1-second audio clip. Unfortunately this cannot currently be modified. APR's ``requirements.txt`` includes ``simpleaudio``. Simply having this python module available changes other behavior, effectively hiding this log noise. label2index KeyError -------------------- This error shows up because unexpected directories were found in data directories. .. code-block:: text File "/home/michael/repos/audio_pattern_ranger/apr/model/nnet.py", line 110, in __getitem__ label = self.label2index[class_name] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^ KeyError: 'barking' This likely requires more careful coding to resolve.