{ "info": { "author": "Dima Koskin", "author_email": "dmksknn@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Multimedia", "Topic :: Multimedia :: Video", "Topic :: Multimedia :: Video :: Conversion" ], "description": "# Sight\n\nSight is a handy module for converting and demuxing video files.\n\n- Change a container for MKV or MP4 without slow re-encoding.\n- Add new streams to the container (and delete other ones easily)\n- View and change the metadata of a container and of all its streams\n\nIt is a new look at some common tasks for FFmpeg (you don't need to know FFmpeg syntax). In fact, you just change some media file attributes, like `extention` or `fps`, and save these changes (see examples below).\n\n\n## CONTENTS\n1. [INSTALLATION](#installation)\n2. [HOW TO](#how-to)\n - [Open the media file](#open-the-media-file)\n\t- [Change the format to another one](#change-the-format-to-another-one)\n\t- [Delete all audio tracks that are not Engilsh](#delete-all-audio-tracks-that-are-not-engilsh)\n\t- [Add subtitles](#add-subtitles)\n\t- [Save the changes](#save-the-changes)\n3. [USAGE](#usage)\n\t- [Open a file](#open-a-file)\n\t- [Discover the media information](#discover-the-media-information)\n\t- [Change what you want](#change-what-you-want)\n\n\n## INSTALLATION\nInstall [FFmpeg](http://ffmpeg.org). You can install it using Homebrew on Mac:\n\n```\nbrew install ffmpeg --with-x265\n```\n\nInstall Sight with pip:\n```\npip install sight\n```\n\nNote, that only **Python 3.6+** is supported.\n\n\n## HOW TO\n\n### Open the media file:\n```\n>>> import sight\n>>> container = sight.open('path/to/file.mkv')\n```\n\n### Change the format to another one:\n**NOTE:** It will be executed fast if the input container codecs are supported by the output container.\n```\n>>> container.extention = '.m4v'\n```\n\n### Delete all audio tracks, that are not Engilsh:\n```\n>>> not_eng = lambda s: s.is_audio and s.metadata['language'] != 'eng'\n>>> container.remove_streams(not_eng)\n```\n\n### Add subtitles:\n```\n>>> subtitles = sight.open('path/to/fre_subtitles.srt')\n>>> subtitles.metadata['language'] = 'fre'\n>>> container.streams.append(subtitles)\n```\n\n### Extract subtitles:\n```\n>>> subtitles = container.subtitles[0]\n>>> subtitles = subtitles.extract(path='new_path/to/rus_subtitles.srt')\n```\n\n### Save the changes:\n\nAfter all the changes, the file must be saved.\n\n**NOTE:** If the `path` or the `extention` of a file was not changed, the file will be rewritten entirely. \n```\n>>> container.save()\n```\n\n## USAGE\n\nSight operates with two kinds of objects: *streams* and *containers*. Streams are *separate* video/audio/subtitles files and containers contain a number of streams. \n\n### Open a file\n\nThe `open` function chooses the object type that needs to be created itself.\n\nOpen the file with several video/audio/subtitles tracks in it:\n```\n>>> container = sight.open('path/to/file.mkv')\nContainer(path=path/to/file.mkv, size=142.65 MB, duration=00:02:00)\n```\n\nOpen the file that contains only video, without any audio or subtitles:\n```\n>>> video_stream = sight.open('path/to/only_video.mkv')\nVideoStream(path=path/to/file.mkv, codec=h264, fps=23.97598627787307, width=1272, height=720, language=eng)\n```\n\nOpen an audio or subtitles file:\n```\n>>> audio_stream = sight.open('path/to/audio.aac')\nAudioStream(path=path/to/audio.aac, codec=aac, channels=2, sample_rate=48000.0, language=eng)\n\n>>> subtitle_stream = sight.open('path/to/subtitles.srt')\nSubtitleStream(path=path/to/subtitles.srt, codec=subrip, is_forced=False, language=rus)\n```\n### Discover the media information\n\nGet the `list` of all streams inside the container:\n```\n>>> container.streams\n...\n```\nGet `tuple` of streams of a certain type:\n```\n>>> container.audios\n...\n>>> container.subtitles\n...\n>>> container.videos\n...\n```\nGet the metadata:\n```\n# global metadata\n>>> container.metadata\n{'title': 'Untitled Movie File'}\n\n# metadata of a certain stream\n>>> *_, last_audio_stream = container.audios\n>>> last_audio_stream.metadata\n{'language': 'eng', 'title': 'Commentary', 'DURATION': '00:02:00'}\n```\n\nGet chapters:\n```\n>>> container.chapters\n...\n ```\n\nGet other media information:\n```\n>>> container.path\n'path/to/file.mkv'\n\n>>> container.extention\n'.mkv'\n\n>>> container.duration\n120.0\n\n>>> container.human_duration\n'00:02:00'\n\n>>> container.size\n149575198\n\n>>> container.human_size\n'142.65 MB'\n\n>>> video, *_ = container.videos\n>>> video.fps\n23.976023976023978\n\n>>> video.codec\n'h264'\n```\n\n### Change what you want\n\nAll the changes to the container are performed by means of changing of its attributes and the following saving.\n\nChange the file extention:\n```\n>>> container.extention = '.m4v'\n\n>>> container.path\n'path/to/file.m4v'\n```\n\nChange the global metadata:\n```\n>>> container.metadata['author'] = \"John Dou\"\n```\n\nOr delete the global metadata at all:\n ```\n>>> container.metadata = {}\n```\n\nChange the FPS of the video stream inside the container:\n```\n>>> video_stream, *_ = container.videos\n>>> video_stream.fps = 23\n```\n\nChange the frame size:\n```\n>>> video_stream.width = 640\n>>> video_stream.height = 480\n```\n\nAnd don't forget to save the changes:\n```\n>>> container.save()\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dmkskn/sight", "keywords": "video metadata converting muxing ffmpeg", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sight", "package_url": "https://pypi.org/project/sight/", "platform": "", "project_url": "https://pypi.org/project/sight/", "project_urls": { "Homepage": "https://github.com/dmkskn/sight" }, "release_url": "https://pypi.org/project/sight/18.6b2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "A simple way to manage video files.", "version": "18.6b2" }, "last_serial": 4018119, "releases": { "18.6b0": [ { "comment_text": "", "digests": { "md5": "ddafadd84b76002135a4dab3b703cc8f", "sha256": "4eedc9dd20db666ff254188b46b54f92dd3b3af607edba5491fb82172c5b0103" }, "downloads": -1, "filename": "sight-18.6b0-py3-none-any.whl", "has_sig": false, "md5_digest": "ddafadd84b76002135a4dab3b703cc8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 12494, "upload_time": "2018-06-26T12:58:31", "url": "https://files.pythonhosted.org/packages/9b/7e/544a211f5e6827e6a09cc4bcd0756e1f74a865ef158b581103a53f1c459d/sight-18.6b0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "808f7d0a645fa61a42629423e0a8c558", "sha256": "f63ef9c67b002416380e68a7da632cadeca43a7f20c46e807f196fa73c81a734" }, "downloads": -1, "filename": "sight-18.6b0.tar.gz", "has_sig": false, "md5_digest": "808f7d0a645fa61a42629423e0a8c558", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 13504, "upload_time": "2018-06-26T12:58:32", "url": "https://files.pythonhosted.org/packages/f8/70/fe0806aa3fd11db6fa919a7b913feefef23f4260644bf9cb35e019b08be1/sight-18.6b0.tar.gz" } ], "18.6b1": [ { "comment_text": "", "digests": { "md5": "0f01ffb7d9fce957e087ad64b80a8a42", "sha256": "7519801920d0b0184c0a63457689ca8fa3d569ca38d58181388442e185d8deb5" }, "downloads": -1, "filename": "sight-18.6b1-py3-none-any.whl", "has_sig": false, "md5_digest": "0f01ffb7d9fce957e087ad64b80a8a42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 12498, "upload_time": "2018-06-26T18:53:03", "url": "https://files.pythonhosted.org/packages/e6/fb/57fd518779736ce7422d4f1a30b35479ebaab50857fbd5dfeba4efe40157/sight-18.6b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a97577b9552b05ad57cdc01b19dfabb", "sha256": "2f7bce21264f8ecf54d2c70271c90b04c13e62c964eaa63aad0a99cb6024fda1" }, "downloads": -1, "filename": "sight-18.6b1.tar.gz", "has_sig": false, "md5_digest": "6a97577b9552b05ad57cdc01b19dfabb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 13518, "upload_time": "2018-06-26T18:53:07", "url": "https://files.pythonhosted.org/packages/69/82/42ecf3362e1b0fc73cbcca48242d9508740299098db41f52ca06c2d48fb9/sight-18.6b1.tar.gz" } ], "18.6b2": [ { "comment_text": "", "digests": { "md5": "b70eb208dcefee2b65c015a61f9973dc", "sha256": "ff0c27bd40ac775a9ad172da47cab973c4fdf5f0c6373db61d399c2f0fb4369a" }, "downloads": -1, "filename": "sight-18.6b2-py3-none-any.whl", "has_sig": false, "md5_digest": "b70eb208dcefee2b65c015a61f9973dc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 13682, "upload_time": "2018-06-30T12:40:54", "url": "https://files.pythonhosted.org/packages/39/73/97ab6de63d652a69e66fc2cb793b6c03082c04c5f2c7fd80dcf057be1178/sight-18.6b2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d670b4e01d9ec211b37b5a0668992888", "sha256": "8f1f7f55a147e0fd87d6800bb673da4a927714edc9af09f0efceef5a2878d0e2" }, "downloads": -1, "filename": "sight-18.6b2.tar.gz", "has_sig": false, "md5_digest": "d670b4e01d9ec211b37b5a0668992888", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 13770, "upload_time": "2018-06-30T12:40:57", "url": "https://files.pythonhosted.org/packages/bb/2c/a4eeace229a17dc1563e8bffff65c9731684543fc74ff2de6813004eafc8/sight-18.6b2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b70eb208dcefee2b65c015a61f9973dc", "sha256": "ff0c27bd40ac775a9ad172da47cab973c4fdf5f0c6373db61d399c2f0fb4369a" }, "downloads": -1, "filename": "sight-18.6b2-py3-none-any.whl", "has_sig": false, "md5_digest": "b70eb208dcefee2b65c015a61f9973dc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 13682, "upload_time": "2018-06-30T12:40:54", "url": "https://files.pythonhosted.org/packages/39/73/97ab6de63d652a69e66fc2cb793b6c03082c04c5f2c7fd80dcf057be1178/sight-18.6b2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d670b4e01d9ec211b37b5a0668992888", "sha256": "8f1f7f55a147e0fd87d6800bb673da4a927714edc9af09f0efceef5a2878d0e2" }, "downloads": -1, "filename": "sight-18.6b2.tar.gz", "has_sig": false, "md5_digest": "d670b4e01d9ec211b37b5a0668992888", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 13770, "upload_time": "2018-06-30T12:40:57", "url": "https://files.pythonhosted.org/packages/bb/2c/a4eeace229a17dc1563e8bffff65c9731684543fc74ff2de6813004eafc8/sight-18.6b2.tar.gz" } ] }