{ "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": "# Shane\n\nShane 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 `extension` 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 Shane with pip:\n```\npip install shane\n```\n\nNote, that only **Python 3.6+** is supported.\n\n\n## HOW TO\n\n### Open the media file:\n```\n>>> import shane\n>>> container = shane.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.extension = '.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_if(not_eng)\n```\n\n### Add subtitles:\n```\n>>> subtitles = shane.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 `extension` of a file was not changed, the file will be overwritten. \n```\n>>> container.save()\n```\n\n## USAGE\n\nShane 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 = shane.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 = shane.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 = shane.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 = shane.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.extension\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 extension:\n```\n>>> container.extension = '.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/shane", "keywords": "video metadata converting muxing ffmpeg", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "shane", "package_url": "https://pypi.org/project/shane/", "platform": "", "project_url": "https://pypi.org/project/shane/", "project_urls": { "Homepage": "https://github.com/dmkskn/shane" }, "release_url": "https://pypi.org/project/shane/18.8b2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "A simple way to manage video files.", "version": "18.8b2" }, "last_serial": 4187769, "releases": { "18.7b0": [ { "comment_text": "", "digests": { "md5": "ea3437195e9b5934238d6e6c3405f97c", "sha256": "66ba213080d762ba9b97fc30cc3ca274dee666de78abd50f9cb5a103986aade9" }, "downloads": -1, "filename": "shane-18.7b0-py3-none-any.whl", "has_sig": false, "md5_digest": "ea3437195e9b5934238d6e6c3405f97c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 13546, "upload_time": "2018-08-04T06:45:21", "url": "https://files.pythonhosted.org/packages/e8/03/fa27a6cb6062b85b79d41b2067164809bca3a61fb993db4d7ff088efe0c7/shane-18.7b0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c7a9f0216c06295c232fd0a34156820", "sha256": "f1adbd2b3f6eadcab55e57a4d56e73b1cebd4fb45b736e49ae5fe95b8b7f7964" }, "downloads": -1, "filename": "shane-18.7b0.tar.gz", "has_sig": false, "md5_digest": "8c7a9f0216c06295c232fd0a34156820", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 14156, "upload_time": "2018-08-04T06:45:23", "url": "https://files.pythonhosted.org/packages/04/a6/6ce2730625b34067cbced21b962f6a7e7a31dc7b141521185a4380e19976/shane-18.7b0.tar.gz" } ], "18.8b1": [ { "comment_text": "", "digests": { "md5": "3bf837b2b6597822c1548b2b385c9f97", "sha256": "8f1aa8a60fd4e9d415009a117208ba397fa25e8149b42fb6027f548b1fd582e0" }, "downloads": -1, "filename": "shane-18.8b1-py3-none-any.whl", "has_sig": false, "md5_digest": "3bf837b2b6597822c1548b2b385c9f97", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 14183, "upload_time": "2018-08-05T12:54:38", "url": "https://files.pythonhosted.org/packages/38/dd/7a36faa0e3c4fd28250ee1664f8d4915d688876707adedbfa0fb7079a519/shane-18.8b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1e18c3f3aa32295b7774f4991936293", "sha256": "2d78b0c87453dfa0fc7507fe1b1706a5dcd1ea7589b450ef12fbac924f43f1fe" }, "downloads": -1, "filename": "shane-18.8b1.tar.gz", "has_sig": false, "md5_digest": "a1e18c3f3aa32295b7774f4991936293", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 16335, "upload_time": "2018-08-05T12:54:39", "url": "https://files.pythonhosted.org/packages/85/d8/102a3d04c6f15d9582869e5fa6c7dde5321f3e0a7a00b54829c49dc88c26/shane-18.8b1.tar.gz" } ], "18.8b2": [ { "comment_text": "", "digests": { "md5": "4370b7e28cb452f892994267481c8d66", "sha256": "f9b3a105abded876ff6ecafe0d3c4f41b5a638a66aff8455d15fb462fab6b0ad" }, "downloads": -1, "filename": "shane-18.8b2-py3-none-any.whl", "has_sig": false, "md5_digest": "4370b7e28cb452f892994267481c8d66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 16483, "upload_time": "2018-08-20T09:39:15", "url": "https://files.pythonhosted.org/packages/77/3b/f6b8ff780461284568594ef639630bb00fb621e10fa1f9c1e23eaf7abf99/shane-18.8b2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f4b65d5279a52abd3ae75a7bca755d3", "sha256": "e27281c672bde7490d683b29ff0e43a60c89001a0ba3a67f4a12fc7dcade34b9" }, "downloads": -1, "filename": "shane-18.8b2.tar.gz", "has_sig": false, "md5_digest": "6f4b65d5279a52abd3ae75a7bca755d3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 17963, "upload_time": "2018-08-20T09:39:17", "url": "https://files.pythonhosted.org/packages/06/e7/f7f5fd25502e0c2e3d19f98af97843c9c4e91a753c7320675f8177f87898/shane-18.8b2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4370b7e28cb452f892994267481c8d66", "sha256": "f9b3a105abded876ff6ecafe0d3c4f41b5a638a66aff8455d15fb462fab6b0ad" }, "downloads": -1, "filename": "shane-18.8b2-py3-none-any.whl", "has_sig": false, "md5_digest": "4370b7e28cb452f892994267481c8d66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 16483, "upload_time": "2018-08-20T09:39:15", "url": "https://files.pythonhosted.org/packages/77/3b/f6b8ff780461284568594ef639630bb00fb621e10fa1f9c1e23eaf7abf99/shane-18.8b2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f4b65d5279a52abd3ae75a7bca755d3", "sha256": "e27281c672bde7490d683b29ff0e43a60c89001a0ba3a67f4a12fc7dcade34b9" }, "downloads": -1, "filename": "shane-18.8b2.tar.gz", "has_sig": false, "md5_digest": "6f4b65d5279a52abd3ae75a7bca755d3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 17963, "upload_time": "2018-08-20T09:39:17", "url": "https://files.pythonhosted.org/packages/06/e7/f7f5fd25502e0c2e3d19f98af97843c9c4e91a753c7320675f8177f87898/shane-18.8b2.tar.gz" } ] }