{ "info": { "author": "Harshveer Singh", "author_email": "ksharshveer@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Local Video Streamer (lvs)\n\n## Description\n\nStream video using lvs from any computer on your home network to any other computer on the same network. Any video file, or one of the attached camera device on a computer can be used as a video source for streaming.\n\n### A Note to Users\n\nThis program provides `video_streamer` package, but is also a working implementation using that package to show some of the features we can get using it. So, it might have bugs. \n\n### A Note to Developers\n\nThe main focus of the package is to make it easy to get video frame by frame (thanks to [opencv](https://opencv.org)), from any computer on the network, which can then be modified in any way preferable.
\n\nThe package provides `video_streamer.py` module with following main classes -\n\n* `MasterVideoIter` to get the video frame by frame from a camera or video file available in a computer.\n* `SlaveVideoIter` to get get the video frame by frame over a network using sockets.\n\n`stream_server.py` is somewhat complicated implementation which uses `MasterVideoIter` to read video and make it available to any program using `SlaveVideoIter`\n\nThen there is the `dataclass_objects.py` module providing following main dataclasses -\n\n* `StreamData` currently only holding `frame`, meaning that `SlaveVideoIter` receives and makes available one video frame at a time. It can be easily extended to include more data per frame, like perhaps an audio frame, making this a complete video with audio streaming program.\n* `PreStreamDataByClient` and `PreStreamDataByServer` are only containers which are shared by client and the server before the streaming starts. Gives them a chance to negotiate settings, other data, etc.\n\n## Features\n\n* `lvs start` runs the server, and multiple clients can connect to it. Fewer clients will result in better performance generally.\n* Server sleeps in 2 seconds intervals until a client requests the stream.\n * Advantage - Video file or camera is not used when no clients connect, making the source available for use by other services in the meantime, and does not waste processing power.\n * Disadvantage - While the camera will always return what it captures right now, Video file will be read from the beginning each time the server wakes up from the sleep.\n* Sweep interval can be set for saved videos which deletes old video files ending with '.avi' in the filename\n* Stream can be requested to include datetime information, with preferred text color, etc. Grayscale(black and white) stream can also be requested instead of colored.\n* Following extensions connect to the running server to provide additional services -\n * `lvs e_http` extends stream service to clients using browser. Closes connection to the server and sleeps in 2 seconds intervals just like the server itself if no client(s) are connected for 10 seconds.\n * `lvs e_view` opens up a window showing video stream. Press `q` or `Q` when this window is selected to stop the video stream.\n * `lvs e_save` saves the video stream in one of the two given ways -\n * Keeps saving video stream continuously in specified length chunks.\n * Saves video of specified length chuck when detection occurs based on provided cascade classifier file\n\n## Installation\n\nRequires python 3.7 or above installed and available in `PATH`\n\n### Windows Users\n\n* Go to [python.org/downloads](https://python.org/downloads), and download python.\n* Open downloaded file, select `Add Python 3.* to PATH`, and click `Install Now`\n\n### Linux Users\n\n* Install python3.7 or above using your linux distribution specific package manager.\nFor ubuntu, you can install it by entering `sudo apt install python3.7` in the terminal\n\n### Installing lvs\n\nOpen command prompt or terminal, and enter `python3 -m pip install lvs`
\nThis should install lvs and all its dependencies.\n\n## Usage\n\n* First of all, I would encourage to have a look at or modify the default configuration file, because this configuration is the heart of this app's behavior. You can view it in terminal by typing `lvs cfg`, or better yet open it in your preferred editor. The file location can be found by entering `lvs cfg_path`. Most settings available in this configuration files can be overridden on the command line. This file contains comments which I hope will be very helpful to understand the program's requirements for use. Here's current copy of config.toml file\n\n```\n# log_level = , a could be \"debug\", \"info\", \"warn\",\n# \"critical\", like log_level = \"info\"\n# log_level = critical will show almost no information\nlog_level = \"info\"\n\n# log_to_file = \"\" will not log to file\n# log_to_file = \"lvs_log.txt\" will save log to /`lvs_log.txt`\n# where is your home directory, like C:/Users/Me\nlog_to_file = \"\"\n\n\n[server_address]\n\n # Use ip = \"127.0.0.1\" or \"localhost\" to connect to server streaming\n # on this device\n # If using stream server on other device, use that device's ip\n ip = \"127.0.0.1\"\n\n # Use port = 4289 for default, use something else if the stream server\n # is using different port\n port = 4289\n\n\n[server_settings]\n\n # source = 0 will try to use default camera device\n # source = 1 will try to use next available camera device\n # source = \"C:/Path/to/video.mp4\" will use video.mp4\n source = 0\n\n # Use ip = \"127.0.0.1\" or \"localhost\" to serve on this device\n # Use ip = \"0.0.0.0\" to make this server available on local network\n ip = \"0.0.0.0\"\n\n # Use port = 4289 for default, use something else if not available\n # Clients will get served by this server when they connect on this port\n port = 4289\n\n # Number of connections to be queued for serving\n backlog = 0\n\n\n[flask_settings]\n\n # Use ip = \"127.0.0.1\" or \"localhost\" to serve on this device\n # Use ip = \"0.0.0.0\" to make this server available on local network\n ip = \"0.0.0.0\"\n\n # Use port = 4288 for default, use something else if not available\n # Clients will get served by this server when connected to this port\n # Enter \":\" in the browser to access the video stream, where\n # shall be replaced by server ip like 192.168.1.23, and \n # shall be replaced by port number like 1234\n # Note that : can be omitted from entering in browser if port = 80,\n # however, using port = 80 may require privileged permissions to run\n port = 4288\n\n # Number of seconds to wait for closing connection to the server after\n # all browser clients have disconnected. Default sleep_delay = 10 seconds\n sleep_delay = 10\n\n # background_color = , changes `index.html`'s background color,\n # where is html background property such as \"white\", \"gray\", etc\n background_color = \"gray\"\n\n # debug = true, will show debug information on errors\n debug = false\n\n\n[stream_settings]\n\n # grayscale = true will result in black and white colored video,\n # but may slightly improve performance\n grayscale = false\n\n # show_datetime = true will embed current datetime info as given by\n # server machine on top of video stream\n show_datetime = false\n\n # show_fps = true will show estimated frames per second served by server\n show_fps = false\n\n # Text color in BGR format i.e [Blue, Green, Red], [255, 0, 0] is blue\n # text_color = [255, 255, 255] is white, [0, 0, 0] is black\n text_color = [255, 255, 255]\n\n # font_scale = 1, size of font\n font_scale = 1\n\n # thickness = 1, text thickness, a whole number\n thickness = 2\n\n\n[save_settings]\n\n # cascade classifier to use for detection purposes. Inside res folder\n # haarcascade_frontalface_default.xml has been copied from opencv,\n # location, /Python/site-packages/cv2/data/*.xml\n cascade_classifier = \"cascade_classifiers/haarcascade_frontalface_default.xml\"\n\n # detection_interval = 15 means run detection on every 15th frame\n # Note that detection is computationally intensive task, and\n # lowering this value could lower performance. Minimum value is 1\n detection_interval = 15\n\n # dir_name = \"lvs_saves\" will result in saving videos inside lvs_saves folder\n dir_name = \"lvs_saves\"\n\n # save_dir = \"\" will default to user's home plus above mentioned dir_name\n # Example path for windows, save_dir = \"C:/Users/Me/Videos\"\n # Example path for linux, save_dir = \"/home/Me/Videos\"\n # Note that certain characters such as a space ' ' need escaping like '\\ '\n save_dir = \"\"\n\n # save_type = \"continuous\" will save all the time ignoring detection\n # save_type = \"detection\" will only save when detection occurs\n save_type = \"continuous\"\n\n # save_duration = 3600 will save videos in 3600 seconds video chunks for\n # save_type = \"continuous\" or save once for every detection when using\n # save_type = \"detection\"\n save_duration = 3600\n\n # older_than = 86400 will delete video files which were created 86400 seconds\n # (1 day) ago and end in \".avi\" extension\n older_than = 86400\n\n # sweep_interval = 0 will result in not sweeping at all\n # sweep_interval = 3600 will check every 3600 seconds(1 hour) to find out\n # the files which should be deleted\n sweep_interval = 0\n\n```\n\n* `lvs --help` entered in command prompt or terminal will show help for the program in general, which can relate to Features defined above.\n\n```\nC:\\Users\\Harsh>lvs --help\nUsage: lvs [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n cfg Shows current configuration settings\n cfg_path Shows location of configuration file currently in use\n e_http Extension to serve video stream for client(s) using browser(s)\n e_save Extension to help in saving video stream\n e_view Extension to show video stream from a running stream server\n start Starts the video stream server\n ```\n\n* To get help for a particular feature like `e_view`, enter `lvs e_view --help` and so on. This will show default settings being used for the feature, but can be overridden\n\n```\nC:\\Users\\Harsh>lvs e_view --help\nUsage: lvs e_view [OPTIONS]\n\n Extension to show video stream from a running stream server. Press 'q' to quit when running.\n\nOptions:\n --server_ip TEXT [default: 127.0.0.1]\n --server_port INTEGER [default: 4289]\n -G, --grayscale / --no-grayscale\n [default: False]\n -D, --show_datetime / --no-show_datetime\n [default: False]\n -F, --show_fps / --no-show_fps [default: False]\n --text_color ...\n [default: 255, 255, 255]\n --font_scale INTEGER [default: 1]\n --thickness INTEGER [default: 2]\n --help Show this message and exit.\n```\n\n* Example streaming on same computer\n * Enter `lvs start` in a terminal to start video stream from default camera on this computer.\n * Open another terminal and enter `lvs e_view -D --text_color 0 255 0` This will show video stream with datetime information added on top left with red colored text.\n* Example streaming over a network\n * First type `ipconfig` (only for windows) and find Ipv4 address, it might be something like `192.168.1.23`. Now enter `lvs start` to start the stream server.\n * Go to the computer where you would like to watch the stream. Enter `lvs e_view --server_ip=\"192.168.1.23\"` as we found the address earlier.\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/ksharshveer/lvs", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lvs", "package_url": "https://pypi.org/project/lvs/", "platform": "", "project_url": "https://pypi.org/project/lvs/", "project_urls": { "Homepage": "https://github.com/ksharshveer/lvs" }, "release_url": "https://pypi.org/project/lvs/1.0/", "requires_dist": [ "opencv-python", "click", "toml", "flask" ], "requires_python": ">=3.7", "summary": "Stream video from camera or video file to devices on your local network", "version": "1.0" }, "last_serial": 5901811, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "7eea2b97dd8f64cb59bccd5e21fe4df6", "sha256": "b51ce20a46524ef174284029b630be95a3ac71626254e5d1de820f6ea83f6fb3" }, "downloads": -1, "filename": "lvs-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7eea2b97dd8f64cb59bccd5e21fe4df6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 158263, "upload_time": "2019-09-29T06:53:23", "url": "https://files.pythonhosted.org/packages/d4/be/4e6e7cfecb52058ba21c2fab8b15636a6639a0d7af2e60a444221dfc8b62/lvs-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "18080dc970b8252a976ee8d78de7b85f", "sha256": "eabc049d75bf551843ac06f9b9a909cc8ea475fc4ea78e77bf3e2d4e0055b51a" }, "downloads": -1, "filename": "lvs-1.0.tar.gz", "has_sig": false, "md5_digest": "18080dc970b8252a976ee8d78de7b85f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 157633, "upload_time": "2019-09-29T06:53:26", "url": "https://files.pythonhosted.org/packages/51/b2/84673efc950612cee22ec19550045340e7fdc4bd00eedba89e362fb275c3/lvs-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7eea2b97dd8f64cb59bccd5e21fe4df6", "sha256": "b51ce20a46524ef174284029b630be95a3ac71626254e5d1de820f6ea83f6fb3" }, "downloads": -1, "filename": "lvs-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7eea2b97dd8f64cb59bccd5e21fe4df6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 158263, "upload_time": "2019-09-29T06:53:23", "url": "https://files.pythonhosted.org/packages/d4/be/4e6e7cfecb52058ba21c2fab8b15636a6639a0d7af2e60a444221dfc8b62/lvs-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "18080dc970b8252a976ee8d78de7b85f", "sha256": "eabc049d75bf551843ac06f9b9a909cc8ea475fc4ea78e77bf3e2d4e0055b51a" }, "downloads": -1, "filename": "lvs-1.0.tar.gz", "has_sig": false, "md5_digest": "18080dc970b8252a976ee8d78de7b85f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 157633, "upload_time": "2019-09-29T06:53:26", "url": "https://files.pythonhosted.org/packages/51/b2/84673efc950612cee22ec19550045340e7fdc4bd00eedba89e362fb275c3/lvs-1.0.tar.gz" } ] }