Archive current and redesign
Intro.
At first, I’ve started this series as practice writing. but, I have blocked on design internal data pipeline.
Currently, rtmp-ingest
repository can be accept stream, write fMP4 segments and generate VOD playlist(that can also used for live stream).
So, Ingest implement is looks completed. and that has topics for writing are just left performance tunning or refactoring related, as I think.
Currently, I don’t implemented RTMP’s play
command, so need to implement transcoder that can process fMP4 segment or processing with buffer.
That makes overheads that makes latency(that cannot accept on these day production)
so, I will archive current project and restart with new design.
Design
Currently, rtmp-rs
library needs too much memory, because, it must be complete each message into concatenate into buffer.
- How about zero-copy ingest?
- Original streams can be written into raw data(
rtmp-ingest
has dump those files).- RTMP already has length informations for rebuild message. and transcoder and edge segmenter require receive AVC NALU as fast as possible.
- Generate fMP4 on ingest makes hard to design scalable system. Transcoder should be wait each segment, or transcoding on ingest(will cause availablity problem).
- Original streams can be written into raw data(
So, as I think, Need to design internal data stream system.
- Maybe using redis with samll chunk splited stream will be acceptable
- but, real-time low-latency with bi-directional communication is my first objective.(that mentioned on first intro post)
- So, Need scalable Pub/Sub Reliable data trasfer(RDT) messaging system.
- For video stream
- Pub
- Each Group of Pictures(GoPs) will be has own channel(temporal terms.)
- Inter-Frame(I-Frame; Keyframe) initate channel
- Configs like
avcC
and ACC audio format config will be store as metadata of channel
- Sub
- Original stream will be directly generate playlist
- Transcoder will receive each GoP and apply scaler for generate variable sub resolutions
- Pub
- Summary
- Channel: Concept similar WebRTC’s Data channel
- Has metadata
- Channel has sub channels that handle video, audio, or other data stream.
- Channel: Concept similar WebRTC’s Data channel
- For video stream
- So, Need scalable Pub/Sub Reliable data trasfer(RDT) messaging system.