New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamGear API: Transcodes videos/audio files & frames for HTTP streaming #155
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… streaming (Solves #105) - New StreamGear API that automates transcoding workflow for generating Ultra-Low Latency, High-Quality, Dynamic & Adaptive Streaming Formats. - Implemented multi-platform , standalone, highly extensible and flexible wrapper around FFmpeg for generating chunked-encoded media segments of the media, and easily accessing almost all of its parameters. - API automatically transcodes videos/audio files & real-time frames into a sequence of multiple smaller chunks/segments and also creates a Manifest file. - Added initial support for [MPEG-DASH](https://www.encoding.com/mpeg-dash/) _(Dynamic Adaptive Streaming over HTTP, ISO/IEC 23009-1)_. - Constructed default behavior in StreamGear, for auto-creating a Primary Stream of same resolution and framerate as source. - Added [TQDM](https://github.com/tqdm/tqdm) progress bar in non-debugged output for visual representation of internal processes. - Implemented several internal methods for preprocessing FFmpeg and internal parameters for producing streams. - Several standalone internal checks to ensure robust performance. - New [`terminate()`](../bonus/reference/streamgear/#vidgear.gears.streamgear.StreamGear.terminate) function to terminate StremGear Safely. - New StreamGear Dual Modes of Operation: + Implemented *Single-Source* and *Real-time Frames* like independent Transcoding Modes. + Linked `-video_source` attribute for activating these modes + **Single-Source Mode**, transcodes entire video/audio file _(as opposed to frames by frame)_ into a sequence of multiple smaller segments for streaming + **Real-time Frames Mode**, directly transcodes video-frames _(as opposed to a entire file)_, into a sequence of multiple smaller segments for streaming + Added separate functions, [`stream()`](../bonus/reference/streamgear/#vidgear.gears.streamgear.StreamGear.stream) for Real-time Frame Mode and [`transcode_source()`](../bonus/reference/streamgear/#vidgear.gears.streamgear.StreamGear.transcode_source) for Single-Source Mode for easy trancoding. + Included auto-colorspace detection and RGB Mode like features _(extracted from WriteGear)_, into StreamGear. - New StreamGear Parameters: + Developed several new parameters such as: + `output`: handles assets directory + `formats`: handles adaptive HTTP streaming format. + `custom_ffmpeg`: handles custom FFmpeg location. + `stream_params`: handles internal and FFmpeg parameter seamlessly. + `logging`: turns logging on or off. + New `stream_params` parameter allows us to exploit almost all FFmpeg parameters and flexibly change its internal settings, and seamlessly generating high-quality streams with its attributes: + `-streams` _(list of dictionaries)_ for building additional streams with `-resolution`, `-video_bitrate` & `-framerate` like sub-attributes. + `-audio` for specifying external audio. + `-video_source` for specifying Single-Source Mode source. + `-input_framerate` for handling input framerate in Real-time Frames Mode. + `-bpp` attribute for handling bits-per-pixels used to auto-calculate video-bitrate. + `-gop` to manually specify GOP length. + `-ffmpeg_download_path` to handle custom FFmpeg download path on windows. + `-clear_prev_assets` to remove any previous copies of SteamGear Assets. - New StreamGear docs, MPEG-DASH demo, and recommended DASH players list: + Added new StreamGear docs, usage examples, parameters, references, new FAQs. + Added Several StreamGear usage examples w.r.t Mode of Operation. + Implemented [**Clappr**](https://github.com/clappr/clappr) based on [**Shaka-Player**](https://github.com/google/shaka-player), as Demo Player. + Hosted StreamGear generated DASH chunks on GitHub and served with `raw.githack.com`. + Introduced variable quality level-selector plugin for Clapper Player. + Provide various required javascripts and implemented additional functionality for player in `extra.js`. + Recommended tested Online, Command-line and GUI Adaptive Stream players. + Implemented separate FFmpeg installation doc for StremGear API. New `helper.py` methods: - Added `validate_video` function to validate video_source. - Added `extract_time` Extract time from give string value. - Added `get_video_bitrate` to caliculate video birate from resolution, framerate, bits-per-pixels values. - Added `delete_safe` to safely delete files of given extension. - Added `validate_audio` to validate audio source. Deployed New Docs Upgrades: - Added new assets like _images, custom scripts, javascripts fonts etc._ for achieving better visual graphics in docs. - Added `clappr.min.js`, `dash-shaka-playback.js`, `clappr-level-selector.min.js` third-party javascripts locally. - Extended Overview docs Hyperlinks to include all major sub-pages _(such as Usage Examples, Reference, FAQs etc.)_. - Replaced GIF with interactive MPEG-DASH Video Example in Stabilizer Docs. - Added new `pymdownx.keys` to replace `[Ctrl+C]/[⌘+C]` formats. - Added new `custom.css` stylescripts variables for fluid animations in docs. - Overridden announce bar and added donation button. - Reimplemented Admonitions contexts and added new ones. - Added StreamGear and its different modes Docs Assets. Updates: - Quoted Gear Headline for understanding each gear easily. - Re-Positioned Gear's banner images in overview for better readability. - Employed `isort` library to sort and group imports in Vidgear APIs. - Replaced simple lists with `pymdownx.tasklist`. - Resized over-sized docs images. - Simplified algorithmic complexities in Gears. - Updated `check_output` and added `force_retrieve_stderr` support to `**kwargs` to extract `stderr` output even on FFmpeg error. - Updated `dicts2args` to support internal repeated `coreX` FFmpeg parameters for StreamGear. - Updated `mkdocs.yml`, `changelog.md` and `README.md` with latest changes. - Moved vidgear docs assets _(i.e images, gifs, javascripts and stylescripts)_ to `override` directory.
abhiTronix
added
ENHANCEMENT ⚡
New Feature/Addition/Improvement
MAINTENANCE 🏗️
Just sorting things out!
WORK IN PROGRESS 🚧
currently been worked on.
DOCS 📜
Issue/PR is related to vidgear docs.
labels
Aug 24, 2020
Fixed wrong variable assignments bug in WriteGear API. Added exception for `list, tuple, int, float` in WriteGear API's `output_params` dict. Added new Helper CI tests and Fixed related bugs. Added new `check_valid_mpd` function to test MPD files validity. Added `mpegdash` library to CI requirements. Fixed wrong type bug in StreamGear. Incremented dev version.
- Added temporary custom `mpegdash` installation - few other minor CI fixes
Codecov Report
@@ Coverage Diff @@
## testing #155 +/- ##
===========================================
+ Coverage 93.79% 94.54% +0.74%
===========================================
Files 14 15 +1
Lines 1836 2198 +362
===========================================
+ Hits 1722 2078 +356
- Misses 114 120 +6
Continue to review full report at Codecov.
|
- Fixed Critical StreamGear Bug: FFmpeg pipeline terminating prematurely in Single-Source Mode. - Added check for valid `output` file extension according to `format` selected in StreamGear. - Replaced IOError with more reliable RuntimeError in StreamGear. - Added StreamGear IO and API intialization CI tests for its Modes. - Bumped codecov.
- Reimplemented audio handler in StreamGear. - Reimplemented `return_testvideo_path` CI function with variable streams. - Simplified default audio-bitrate logic in StreamGear - Updated `validate_audio` Helper function will now retrieve audio-bitrate for validation. - Added new Video-only and Audio-Only sources in bash scripts. - Added new path for storing StreamGear assets temporarily in bash scripts. - Added More StreamGear CI Tests. - Fixed few wrong definition. - Bumped Dev version
- Fixed AttributeError with wrong `contentType` definition - Fixed wrong logic for extracting OpenCV frames - Few other Minor tweaks
- Fixed missing defintions and logic bug. - Replaced wrong `mimeType` attribute from CI. - Added missing docs. - Fixed few typos.
⚠️ temp(`/tmp`) is not a valid directory for WriteGear. - Fixed WriteGear not supporting temp directory. - Fixed NameError bugs in StreamGear CI. - Fixed `framerate` attribute not supported by mpegdash.
- Fixed StreamGear's wrong attribute name. - Replaced wrong `audioSamplingRate` definition. - Fixed missing source dimensions from `extract_resolutions` output. - Created new `temp_write` temp directory for WriteGear Assets in bash script. - Assigned `temp_write` to WriteGear's Compression CI tests.
- Fixed incorrect external audio handler bug, moved audio-input to input_parameters. - Updated core parameters for audio handling. - Fixed default `gop` value not handle correctly. - Fixed OSError in WriteGear's compression mode. - Fixed several CI bugs and updated `extract_resolutions` method. - Bumped dev version.
- Added workaround for system path not handle correctly. - Enforced pixel formats for streams. - Fixed StreamGear CI bugs for Windows and CI envs.
- Fixed Bug: URL Audio format not being handled properly. - Increased logging. - Bumped codecov.
- Added StreamGear to codecov. - Fixed `get_valid_ffmpeg_path` throwing TypeError
- Lossless Webp compressed all png assets for faster loading. - Enabled lazy loading for gifs for Performance Improvements. - Deleted old Redundant assets and added new ones. - Updated ReadME.md with new changes. - Added `Request Info` and `Welcome` GitHub Apps to automate PR and issue workf$ - Added new `config.yml` for customizations. - Added various suitable configurations. - Updated Issue and PR templates. - Reimplemented images with <figure> and <figurecaption> like tags. - Updated PR guidelines for more clarity.
- Updated Licenses for new files and tweaked templates. - Updated changelog.md and ReadME.md. - Added and reformated new assets.
abhiTronix
changed the title
[WIP] StreamGear API: Transcodes videos/audio files & frames for HTTP streaming
StreamGear API: Transcodes videos/audio files & frames for HTTP streaming
Aug 30, 2020
abhiTronix
added
SOLVED 🏁
This issue/PR is resolved now. Goal Achieved!
and removed
WORK IN PROGRESS 🚧
currently been worked on.
labels
Aug 30, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
BUG 🐛
Vidgear api's error, flaw or fault
DOCS 📜
Issue/PR is related to vidgear docs.
ENHANCEMENT ⚡
New Feature/Addition/Improvement
MAINTENANCE 🏗️
Just sorting things out!
SOLVED 🏁
This issue/PR is resolved now. Goal Achieved!
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
StreamGear is built for Ultra-Low Latency, High-Quality, Dynamic & Adaptive Streaming Formats (such as MPEG-DASH) with FFmpeg to generate the chunked-encoded media segments of the content, in just few lines of python code. StreamGear provides a standalone, highly extensible and flexible wrapper around FFmpeg - a leading multimedia framework and access to almost all of its parameter for seamlessly generating these streams.
SteamGear API automatically transcodes source videos/audio files & real-time frames, and breaks them into a sequence of multiple smaller chunks/segments (typically 2-4 seconds in length) at different quality levels (i.e. different bitrates or spatial resolutions). It also creates a media presentation description (MPD in-case of DASH) that describes these segment information (timing, URL, media characteristics like video resolution and bit rates), and is provided to the client prior to the streaming session. Thereby, segments are served on a web-server and can be downloaded through HTTP standard compliant GET requests. This makes it possible to stream videos at different quality levels, and to switch in the middle of a video from one quality level to another one.
SteamGear currently only supports MPEG-DASH (Dynamic Adaptive Streaming over HTTP, ISO/IEC 23009-1), but other adaptive streaming technologies such as Apple HLS, Microsoft Smooth Streaming, will be added soon.
Requirements / Checklist
TODO
Related Issue
Context
This PR is aimed at realizing much awaited Streaming API for vidgear. This PR also adds some pretty cool enhancements and bug-fixes. kudos 🎉
Types of changes
Screenshots (if available):