Skip to content

Commit

Permalink
Merge pull request #38 from ratoaq2/develop
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
ratoaq2 committed Apr 8, 2021
2 parents fd41976 + 74a1425 commit e7cc0d7
Show file tree
Hide file tree
Showing 123 changed files with 4,944 additions and 3,062 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -79,6 +79,7 @@ celerybeat-schedule
.env

# virtualenv
.venv*/
venv*/
ENV/

Expand Down
13 changes: 8 additions & 5 deletions .travis.yml
Expand Up @@ -2,12 +2,9 @@ sudo: false

language: python

dist: xenial
dist: focal

python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
Expand All @@ -21,6 +18,7 @@ addons:
packages:
- mediainfo
- ffmpeg
- mkvtoolnix

cache:
directories:
Expand All @@ -33,6 +31,11 @@ before_install:
- pip install --upgrade pytest

install:
- pip install tox-travis
- pip install -e .

script: python setup.py test --addopts "--verbose $PYTEST_ADDOPTS"
script: tox

after_script:
- tox -e lint
- tox -e type-check
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
FROM python:3.9-slim

RUN apt-get update \
&& apt-get install -y mediainfo ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /usr/src/app

COPY . /usr/src/app
RUN cd /usr/src/app \
&& pip install --no-cache-dir -r requirements.txt

WORKDIR /

ENTRYPOINT ["knowit"]
CMD ["--help"]
131 changes: 97 additions & 34 deletions README.rst
Expand Up @@ -25,11 +25,11 @@ CLI
Extract information from a video file::

$ knowit /folder/Audio Samples/hd_dtsma_7.1.mkv
For: /folder/Audio Samples/7.1Ch DTS-HD MA - Speaker Mapping Test File.mkv
Knowit 0.2.4 found:
For: /folder/Audio Samples/hd_dtsma_7.1.mkv
Knowit 0.4.0 found:
{
"title": "7.1Ch DTS-HD MA - Speaker Mapping Test File",
"path": "/folder/Audio Samples/7.1Ch DTS-HD MA - Speaker Mapping Test File.mkv",
"path": "/folder/Audio Samples/hd_dtsma_7.1.mkv",
"duration": "0:01:37",
"size": "40.77 MB",
"bit_rate": "3.3 Mbps",
Expand All @@ -41,17 +41,16 @@ Extract information from a video file::
"width": "1920 pixel",
"height": "1080 pixel",
"scan_type": "Progressive",
"aspect_ratio": 1.778,
"pixel_aspect_ratio": 1.0,
"aspect_ratio": "1.778",
"pixel_aspect_ratio": "1.0",
"resolution": "1080p",
"frame_rate": "23.976 FPS",
"bit_depth": "8 bit",
"codec": "H.264",
"profile": "Main",
"profile_level": "4",
"media_type": "video/H264",
"default": true,
"language": "Undetermined"
"default": true
}
],
"audio": [
Expand All @@ -71,18 +70,24 @@ Extract information from a video file::
"default": true
}
],
"provider": "libmediainfo.so.0"
"provider": {
"name": "mediainfo",
"version": {
"pymediainfo": "5.0.3",
"libmediainfo.so.0": "v20.9"
}
}
}


Extract information from a video file using ffprobe::
Extract information from a video file using ffmpeg::

$ knowit --provider ffmpeg /folder/Audio Samples/hd_dtsma_7.1.mkv
For: /folder/Audio Samples/7.1Ch DTS-HD MA - Speaker Mapping Test File.mkv
Knowit 0.2.4 found:
For: /folder/Audio Samples/hd_dtsma_7.1.mkv
Knowit 0.4.0 found:
{
"title": "7.1Ch DTS-HD MA - Speaker Mapping Test File",
"path": "/folder/Audio Samples/7.1Ch DTS-HD MA - Speaker Mapping Test File.mkv",
"path": "/folder/Audio Samples/hd_dtsma_7.1.mkv",
"duration": "0:01:37",
"size": "40.77 MB",
"bit_rate": "3.3 Mbps",
Expand All @@ -93,15 +98,14 @@ Extract information from a video file using ffprobe::
"width": "1920 pixel",
"height": "1080 pixel",
"scan_type": "Progressive",
"aspect_ratio": 1.778,
"pixel_aspect_ratio": 1.0,
"aspect_ratio": "1.778",
"pixel_aspect_ratio": "1.0",
"resolution": "1080p",
"frame_rate": "23.976 FPS",
"bit_depth": "8 bit",
"codec": "H.264",
"profile": "Main",
"default": true,
"language": "Undetermined"
"default": true
}
],
"audio": [
Expand All @@ -118,17 +122,78 @@ Extract information from a video file using ffprobe::
"default": true
}
],
"provider": "ffprobe"
"provider": {
"name": "ffmpeg",
"version": {
"ffprobe": "v4.2.4-1ubuntu0.1"
}
}
}



Using docker::

docker run -it --rm -v /folder:/folder knowit /folder/Audio Samples/hd_dtsma_7.1.mkv
For: /folder/Audio Samples/hd_dtsma_7.1.mkv
Knowit 0.4.0 found:
{
"title": "7.1Ch DTS-HD MA - Speaker Mapping Test File",
"path": "/folder/Audio Samples/hd_dtsma_7.1.mkv",
"duration": "0:01:37",
"size": "40.77 MB",
"bit_rate": "3.3 Mbps",
"container": "mkv",
"video": [
{
"id": 1,
"duration": "0:01:37",
"width": "1920 pixel",
"height": "1080 pixel",
"scan_type": "Progressive",
"aspect_ratio": "1.778",
"pixel_aspect_ratio": "1.0",
"resolution": "1080p",
"frame_rate": "23.976 FPS",
"bit_depth": "8 bit",
"codec": "H.264",
"profile": "Main",
"profile_level": "4",
"media_type": "video/H264",
"default": true
}
],
"audio": [
{
"id": 2,
"name": "7.1Ch DTS-HD MA",
"language": "English",
"duration": "0:01:37",
"codec": "DTS-HD",
"profile": "Master Audio",
"channels_count": 8,
"channels": "7.1",
"bit_depth": "24 bit",
"bit_rate_mode": "Variable",
"sampling_rate": "48.0 KHz",
"compression": "Lossless",
"default": true
}
],
"provider": {
"name": "mediainfo",
"version": {
"pymediainfo": "5.0.3",
"libmediainfo.so.0": "v20.9"
}
}
}

All available CLI options::

$ knowit --help
usage: knowit [-h] [-p PROVIDER] [-E] [-v] [-r] [--report] [-y] [-N]
[-P PROFILE] [--mediainfo MEDIAINFO] [--ffmpeg FFMPEG]
[--version]
[videopath [videopath ...]]
usage: knowit [-h] [-p PROVIDER] [--debug] [--report] [-y] [-N] [-P PROFILE] [--mediainfo MEDIAINFO] [--ffmpeg FFMPEG] [--mkvmerge MKVMERGE] [--version] [videopath [videopath ...]]

positional arguments:
videopath Path to the video to introspect
Expand All @@ -138,25 +203,21 @@ All available CLI options::

Providers:
-p PROVIDER, --provider PROVIDER
The provider to be used: mediainfo, ffmpeg or enzyme.

Input:
-E, --fail-on-error Fail when errors are found on the media file.
The provider to be used: mediainfo, ffmpeg, mkvmerge or enzyme.

Output:
-v, --verbose Display debug output
-r, --raw Display raw properties
--debug Print information for debugging knowit and for reporting bugs.
--report Parse media and report all non-detected values
-y, --yaml Display output in yaml format
-N, --no-units Display output without units
-P PROFILE, --profile PROFILE
Display values according to specified profile: code,
default, human, technical
Display values according to specified profile: code, default, human, technical

Configuration:
--mediainfo MEDIAINFO
The location to search for MediaInfo binaries
--ffmpeg FFMPEG The location to search for FFmpeg (ffprobe) binaries
--ffmpeg FFMPEG The location to search for ffprobe (FFmpeg) binaries
--mkvmerge MKVMERGE The location to search for mkvmerge (MKVToolNix) binaries

Information:
--version Display knowit version.
Expand All @@ -175,12 +236,14 @@ the ``--user`` flag.

External dependencies
-------------------------
KnowIt can use MediaInfo or FFmpeg (ffprobe)
KnowIt can use MediaInfo, ffprobe (FFmpeg) or mkvmerge (MKVToolNix)

KnowIt supports MKV regardless if MediaInfo or FFmpeg are installed.
KnowIt supports MKV regardless if MediaInfo, FFmpeg or MKVToolNix are installed.

MediaInfo or FFmpeg increases the number of supported formats and the number of extracted information.
MediaInfo, FFmpeg or MKVToolNix increases the number of supported formats and the number of extracted information.

MediaInfo is the default provider. Visit their `website <http://mediaarea.net/MediaInfo>`_ and install the proper package for your system.

FFmpeg (ffprobe) can be downloaded `here <https://ffmpeg.org/download.html>`_
ffprobe (FFmpeg) can be downloaded `here <https://ffmpeg.org/download.html>`_

mkvmerge (MKVToolNix) can be downloaded `here <https://mkvtoolnix.download/downloads.html>`_
18 changes: 3 additions & 15 deletions knowit/__init__.py
@@ -1,13 +1,10 @@
# -*- coding: utf-8 -*-
"""Know your media files better."""
from __future__ import unicode_literals

__title__ = 'knowit'
__version__ = '0.3.0'
__version__ = '0.4.0'
__short_version__ = '.'.join(__version__.split('.')[:2])
__author__ = 'Rato AQ2'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016-2017, Rato AQ2'
__copyright__ = 'Copyright 2016-2021, Rato AQ2'
__url__ = 'https://github.com/ratoaq2/knowit'

#: Video extensions
Expand All @@ -19,13 +16,4 @@
'.omf', '.ps', '.qt', '.ram', '.rm', '.rmvb', '.swf', '.ts', '.vfw', '.vid', '.video', '.viv',
'.vivo', '.vob', '.vro', '.webm', '.wm', '.wmv', '.wmx', '.wrap', '.wvx', '.wx', '.x264', '.xvid')

try:
from collections import OrderedDict
except ImportError: # pragma: no cover
from ordereddict import OrderedDict
else:
import sys
if sys.version_info >= (3, 6):
OrderedDict = dict

from .api import KnowitException, know
from knowit.api import KnowitException, know

0 comments on commit e7cc0d7

Please sign in to comment.