コード例 #1
0
    def file_probe(self, vid_file_path):
        """
        Give a json from ffprobe command line

        :param vid_file_path: The absolute (full) path of the video file, string.
        :return:
        """
        # Get the file probe info
        probe_info = unffmpeg.Info().file_probe(vid_file_path)

        # Get FPS from file probe info
        self.src_fps = None
        try:
            self.src_fps = eval(probe_info['streams'][0]['avg_frame_rate'])
        except ZeroDivisionError:
            # Warning, Cannot use input FPS
            self._log('Warning, Cannot use input FPS', level='warning')
        if self.src_fps == 0:
            raise ValueError('Unexpected zero FPS')

        # Get Duration from file probe info
        self.duration = None
        try:
            self.duration = float(probe_info['format']['duration'])
        except ZeroDivisionError:
            # Warning, Cannot use input Duration
            self._log('Warning, Cannot use input Duration', level='warning')

        if self.src_fps is None and self.duration is None:
            raise ValueError('Unable to match against FPS or Duration.')

        return probe_info
コード例 #2
0
    def get_all_supported_codecs(self):
        """
        Return a list of all codecs supported by unmanic

        :return:
        """
        return unffmpeg.Info().get_all_supported_codecs()
コード例 #3
0
ファイル: config.py プロジェクト: ajaysinghchhonker/unmanic
    def __init__(self):
        # Non config items (objects)
        self.name = "Config"
        self.settings = None

        # Set default db config
        self.DATABASE = None
        self.apply_default_db_settings()
        # Run DB migrations
        self.run_db_migrations()
        # Init DB connection and read settings
        self.import_settings_from_db()
        # Import env variables
        self.import_settings_from_env()
        # Finally, read config from file and override all above settings.
        self.import_settings_from_file()
        # Apply settings to the unmanic logger
        self.setup_unmanic_logger()
        # Set the supported codecs (for destination)
        self.SUPPORTED_CODECS = unffmpeg.Info().get_all_supported_codecs()
        # Set the supported containers (for destination)
        self.SUPPORTED_CONTAINERS = unffmpeg.containers.get_all_containers()
        # TODO: Remove temporary beta data migration
        history_logging = history.History(self)
        history_logging.migrate_old_beta_data()
コード例 #4
0
ファイル: test_unffmpeg_info.py プロジェクト: tlt21/unmanic
 def test_can_read_ffmpeg_supported_codecs(self):
     # Fetch a list of supported codecs from unffmpeg
     all_codecs = unffmpeg.Info().get_all_supported_codecs()
     # Ensure audio codecs are available
     assert 'audio' in all_codecs
     # Ensure video codecs are available
     assert 'video' in all_codecs
コード例 #5
0
ファイル: test_unffmpeg_info.py プロジェクト: tlt21/unmanic
 def test_can_read_ffmpeg_supported_video_codecs(self):
     # Fetch a list of supported codecs from unffmpeg
     all_codecs = unffmpeg.Info().get_all_supported_codecs()
     # Ensure h264 is available
     assert 'h264' in all_codecs['video']
     # Ensure h265 is available
     assert 'hevc' in all_codecs['video']
     # Ensure a gibberish codec is not available
     assert 'NONSENSE CODEC' not in all_codecs['video']
コード例 #6
0
ファイル: system.py プロジェクト: luis4ndre/unmanic
    def __get_ffmpeg_info(self):
        """
        Return a dictionary of ffmpeg information

        TODO:
            Parse codecs

        :return:
        """
        from unmanic.libs import unffmpeg
        ffmpeg_info = unffmpeg.Info()
        if not self.ffmpeg:
            self.ffmpeg = {
                "versions":                ffmpeg_info.versions(),
                "hw_acceleration_methods": ffmpeg_info.get_available_ffmpeg_hw_acceleration_methods(),
                "decoders":                ffmpeg_info.get_available_ffmpeg_decoders(),
                "encoders":                ffmpeg_info.get_available_ffmpeg_encoders(),
            }
        return self.ffmpeg
コード例 #7
0
    def __init__(self, db_file=None):
        # Non config items (objects)
        self.name = "Config"
        self.settings = None

        # Set default UI port
        self.UI_PORT = 8888
        # Set default config directory
        self.CONFIG_PATH = CONFIG_PATH

        # Set default db config
        self.DATABASE = None
        self.apply_default_db_settings()
        # Overwrite default DB config
        if db_file:
            self.DATABASE['FILE'] = db_file

        # Import env variables and override all previous settings.
        self.import_settings_from_env()
        # Read config from file and override all previous settings (this may include the DB location).
        self.import_settings_from_file()
        # Run DB migrations
        self.run_db_migrations()
        # Init DB connection and read settings
        self.import_settings_from_db()
        # Finally, re-read config from file and override all previous settings.
        self.import_settings_from_file()
        # Apply settings to the unmanic logger
        self.setup_unmanic_logger()
        # Set the supported codecs (for destination)
        self.SUPPORTED_CODECS = unffmpeg.Info().get_all_supported_codecs()
        # Set the supported containers (for destination)
        self.SUPPORTED_CONTAINERS = unffmpeg.containers.get_all_containers()
        # TODO: Remove temporary beta data migration
        history_logging = history.History(self)
        history_logging.migrate_old_beta_data()