# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['conti']

package_data = \
{'': ['*']}

install_requires = \
['nxtools>=1.6.0,<2.0.0']

entry_points = \
{'console_scripts': ['docs = scripts:docs', 'test = scripts:test']}

setup_kwargs = {
    'name': 'conti',
    'version': '1.0',
    'description': 'Minimalistic FFMpeg based playout server',
    'long_description': 'Conti\n=====\n\n*FFMpeg based playout server*\n\nAbout the project\n-----------------\n\nConti is a simple linear video playout server. It enables you to broadcast\nyour video files with minimal configuration and hardware requirements.\n\nConti demo script can be modified to run simple stand-alone channels such as\nlobby TVs, info channels, community TV stations, and so on.\n\nFor more complex projects, [Nebula](https://github.com/immstudios/nebula) \nbroadcast automation system can be used for scheduling and playout control.\n\n### Features\n\nConti has a very simple architecture allowing extensive tweaking. Most of the features\ncome from FFMpeg, notably:\n\n - Vast source format support\n - Multiple simultaneous outputs including RTP, RTMP, MPEG-TS, NDI and SDI\n - Video and audio filtering on a source, global, or output level. This includes\n   on-the-fly loudness normalization, station logo burn-in, ARC and so on.\n - Up to 16 channel audio support with channels shuffling.\n - Hardware-accelerated encoding (nvenc) of selected formats (h.264, HEVC)\n\n### Limitations\n\n - Most of the output formats does not support pausing. \n   It is possible to pause Decklink or SDL outputs by calling `Conti.freeze(self)` method,\n   but IP streams have to run all the time.\n - It is not possible to control displayed graphics overlays during playback. \n - There is probably no easy way to create a continuous text crawl. \n   [Prove us wrong](https://github.com/immstudios/conti/issues/new).\n - Looping is not implemented yet (but is planned) \n - *source* and *output* filters usage differs slightly. We want to unify the behavior.\n\nQuick start\n-----------\n\nConti runs on Linux (no other OS has been tested) and requires Python3, FFMpeg and\nnxtools.\n\n### FFMpeg\n\nFor the most use-cases, FFMpeg build available in your favorite Linux distribution\nis sufficient. \n\nIn case you need Blackmagic Decklink or NDI I/O, you may use our build script from \n[this repository](https://github.com/immstudios/installers).\n\n### nxtools\n\n[nxtools](https://github.com/immstudios/nxtools) is a set of Python utilities \nwe use for many tasks. Install it using `pip3 install nxtools`\n\n### Running Conti\n\nClone this repository and tweak conti.py script to point to your data location\n(directory with your video files)\n\nBy default, Conti streams in RTP over multicast to `rtp://224.0.0.1:2000`,\nbut you can change the destination as well as the encoding profile(s).\n\nStart `./conti.py` and tune your station:\nStart VLC on any machine in your network, hit ctrl+n and enter `rtp://@224.0.0.1:2000`.\n\nArchitecture\n------------\n\nConti uses several FFMpeg processes tied together using pipes to produce a gapless stream.\nEach **source** (`ContiSource` Python class) spawns an FFMpeg process with a filter-chain\nwhich handles format and tracks layout normalization and pipes its uncompressed output to\nthe encoder process. Conti opens several source processes in advance, so right after one \nclip is finished, the next one can be started without delays. \n\nThe encoder process applies *global output filter-chain* to the piped input (e.g. audio\nnormalization), splits the output if there is more than one output specified, applies\n*per-output* filter-chains and transcode or output the result to the desired streams/devices.\n\nExamples\n--------\n\nFeel free to tweak the sample script to meet your needs.\nYou can modify the `get_next` method to play different media files in\ndifferent parts of the day or to follow a playlist stored in a database.\n\nFollowing `settings.json` file instruct the `conti.py` demo script to playback media files from the\nchosen directory, the top-level `video_filters` parameter is applied to all outputs\n(in this case, black&white conversion). Two SDL outputs (desktop windows) are defined, but the audio \noutput is not used. The second output has its feed horizontally flipped.\n\n```json\n{\n    "media_dir" : "/export/media.dir",\n    "video_filters" : "hue=s=0",\n    "outputs" : [ \n    {\n        "target" : "SDL Output 1",\n        "audio" : false,\n        "params" : {\n            "c:v" : "rawvideo",\n            "f" : "sdl",\n            "pix_fmt" : "yuv420p"\n        }\n    },\n    {\n        "target" : "SDL Output 2",\n        "audio" : false,\n        "video_filters": "hflip",\n        "params" : {\n            "c:v" : "rawvideo",\n            "f" : "sdl",\n            "pix_fmt" : "yuv420p"\n        }\n    }\n\n]\n}\n```\n\n > Note: SDL is not available in the immstudios ffmpeg build (yet)\n\n### Pipe format\n\nThe example assumes 1080p25 is used as an "intermediate" format (the format which goes thru the pipe),\nbut at the top level of the `settings.json` you may override the following default values.\n\n```json\n{\n        "width"           : 1920,\n        "height"          : 1080,\n        "frame_rate"      : 25,\n        "pixel_format"    : "yuv422p",\n        "audio_only"      : false,\n        "audio_codec"     : "pcm_s16le",\n        "audio_sample_rate" : 48000,\n}\n```\n\n### Decklink\n\nDecklink cards are very picky regarding the used format, especially the interlaced flag.\nIn order to output 1080i50, use the default values of the pipe format and use the following values\nfor your output.\n\n```json\n{\n    "target" : "DeckLink SDI",\n    "video_filters" : "setfields=tff",\n    "params" : {\n        "field_order" : "tt",\n        "f" : "decklink",\n        "pix_fmt" : "uyvy422"\n    }\n}\n```\n\n### Audio\n\nAll sources are converted to 16channels audio, so in order to get a stereo output (for example for an IP stream),\nuse `{"audio_filters" : "pan=stereo|c0=c0|c1=c1}` or similar to get the desired channel pair.\n\n\n\n\n',
    'author': 'Martin Wacker',
    'author_email': 'martas@imm.cz',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/immstudios/conti',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
