How to push individual .ts files to Medialive rtmp push url for seemless live streaming?
I'm working on project which performs blurring faces in real-time using live input from a phone camera. I have two Medialive channels -
Channel 1 - RTMP push input. Input is given by a live streaming app which takes camera input and pushes it to the rtmp url. Output is list of ts segments which go through some lambda functions to detect faces (using rekognition) in each .ts segment and perform blurring at the detected coordinates of the segment using openCV. Output ts segment is uploaded to s3.
Channel 2 - RTMP push input *. Input is the resulting .ts file which contains blurred faces which is pushed to the rtmp url after the blurring process is complete. Output ts segment is uploaded to s3 and path is provided to cloudfront for live stream.
I'm using ffmpeg command to push the face blurred segment to the rtmp url of channel 2. The issue is that the pushing happens randomly whenever the blurring process is completed. The resulting live stream contains black screen for a few seconds after each segment. How to resolve this issue? Or suggest any other way to work with the edited .ts segments.
*The reason for second channel - The ts segments from channel 1 contain metadata which is lost in the face blurring process as a new ts file is generated. Hence, the .m3u8 playlist file is not able to play the segments sequentially. To resolve this, I'm pushing the .ts files at the end of the face blurring process to the rtmp url of the second channel. The result is that I get new .ts segments with m3u8 file and the stream can run seemlessly (however the ts segments themselves contain black screens as the rtmp url of channel 2 doesn't get continuous input).