How to use the av.logging.set_level function in av

To help you get started, we’ve selected a few av examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JunweiLiang / Object_Detection_Tracking / diva_io / video / reader.py View on Github external
Raises
        ------
        FileNotFoundError
            If the video file to read does not exist.
        """
        self.path = osp.join(parent_dir, video_path)
        if not osp.exists(self.path):
            raise FileNotFoundError(self.path)
        if silence_warning:
            self._logger = get_logger(
                '%s@%s' % (__name__, self.path), logging.WARNING)
            av.logging.set_level(av.logging.FATAL)
        else:
            self._logger = get_logger(
                '%s@%s' % (__name__, self.path), logging.INFO)
            av.logging.set_level(av.logging.INFO)
        self._assert_msg = ' Please report %s to Lijun.' % (self.path)
        self.fix_missing = fix_missing
        if not self.fix_missing:
            self._logger.warning('NOT fixing missing frames.')
        self._init()
        self.length = self._stream.duration
        self.fps = float(self._stream.average_rate)
        self.height = self._stream.codec_context.format.height
        self.width = self._stream.codec_context.format.width
        self.shape = (self.height, self.width)
github JunweiLiang / Object_Detection_Tracking / diva_io / video / reader.py View on Github external
Whether to silence warnings from ffmpeg and warnings about missing 
            frames when `fix_missing=True`. Warnings about missing frames are 
            not silenced when `fix_missing=False`.

        Raises
        ------
        FileNotFoundError
            If the video file to read does not exist.
        """
        self.path = osp.join(parent_dir, video_path)
        if not osp.exists(self.path):
            raise FileNotFoundError(self.path)
        if silence_warning:
            self._logger = get_logger(
                '%s@%s' % (__name__, self.path), logging.WARNING)
            av.logging.set_level(av.logging.FATAL)
        else:
            self._logger = get_logger(
                '%s@%s' % (__name__, self.path), logging.INFO)
            av.logging.set_level(av.logging.INFO)
        self._assert_msg = ' Please report %s to Lijun.' % (self.path)
        self.fix_missing = fix_missing
        if not self.fix_missing:
            self._logger.warning('NOT fixing missing frames.')
        self._init()
        self.length = self._stream.duration
        self.fps = float(self._stream.average_rate)
        self.height = self._stream.codec_context.format.height
        self.width = self._stream.codec_context.format.width
        self.shape = (self.height, self.width)
github pupil-labs / pupil / pupil_src / shared_modules / audio_capture.py View on Github external
import numpy as np

from plugin import Plugin
from pyglui import ui
from audio import Audio_Input_Dict
from threading import Thread, Event
from scipy.interpolate import interp1d
from time import time

import platform
import logging
import re

assert av.__version__ >= "0.3.0"
logger = logging.getLogger(__name__)
av.logging.set_level(av.logging.ERROR)


NOT_REC_STR = "Start a new recording to save audio."
REC_STR = 'Saving audio to "audio.mp4".'


class Audio_Capture(Plugin):
    """docstring for Audio_Capture"""

    icon_chr = chr(0xE029)
    icon_font = "pupil_icons"

    def __init__(self, g_pool, audio_src="No Audio"):
        super().__init__(g_pool)
        self.audio_devices_dict = Audio_Input_Dict()
        if audio_src in list(self.audio_devices_dict.keys()):
github pupil-labs / pupil / pupil_src / shared_modules / video_capture / file_backend.py View on Github external
'''
(*)~----------------------------------------------------------------------------------
 Pupil - eye tracking platform
 Copyright (C) 2012-2016  Pupil Labs

 Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0).
 License details are in the file license.txt, distributed as part of this software.
----------------------------------------------------------------------------------~(*)
'''

import os,sys
import av
assert av.__version__ >= '0.2.5'

av.logging.set_level(av.logging.ERROR)

from .base_backend import InitialisationError, StreamError, Base_Source, Base_Manager
from .fake_backend import Fake_Source

import numpy as np
from time import time,sleep
from fractions import Fraction
from  multiprocessing import cpu_count
import os.path

#logging
import logging
logger = logging.getLogger(__name__)

class FileCaptureError(Exception):
    """General Exception for this module"""
github pupil-labs / pupil / pupil_src / shared_modules / video_capture / file_backend.py View on Github external
import numpy as np
import typing as T

from multiprocessing import cpu_count
from abc import ABC, abstractmethod
from time import sleep
from camera_models import load_intrinsics
from .utils import VideoSet

import player_methods as pm
from .base_backend import Base_Manager, Base_Source, EndofVideoError, Playback_Source
from pupil_recording import PupilRecording

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
av.logging.set_level(av.logging.ERROR)
logging.getLogger("libav").setLevel(logging.ERROR)

assert av.__version__ >= "0.4.3", "pyav is out-of-date, please update"


class FileSeekError(Exception):
    pass


class Frame:
    """docstring of Frame"""

    def __init__(self, timestamp, av_frame, index):
        self.timestamp = float(timestamp)
        self.index = int(index)
        self.width = av_frame.width