Add VOD file to mixer delay

Luca

Member
Hi

I am trying to setup VOD stream in a way that once it start playing, the file is added straight into the mixer so we can stream it via RTMP(I know we can stream directly to RTMP without the mixer, however you will understand later in the post why we need to use the mixer).

Steps Below:

1. Creating Stream from a VOD file(on remote File server) using WebSDK

2. on.STREAM_STATUS.PLAYING or on.STREAM_STATUS.PENDING the stream created above gets added to the mixer using REST API so it is visible in the mixer itself.

The following happens:

At step 2 the audio starts playing in the mixer pretty instantly, however the video is only visible after few seconds, I am assuming is due to a delay of the API to fetch the VOD stream and add to the mixer, however this delay pretty much makes the above process unusable.

We would like to use the application as a "Video Mixer" which I assume is the reason why you guys have created the Mixer functionality, however VOD mixing with Live Streams is a big thing when doing video mixing, is there any other way I can make this to work?

Please let me know
Thank you
Best
Luca
 

Max

Administrator
Staff member
Good day.
1. Creating Stream from a VOD file(on remote File server) using WebSDK
First, for restreaming it is recommended to start VOD files using REST API: VOD capture management with REST API
At step 2 the audio starts playing in the mixer pretty instantly, however the video is only visible after few seconds, I am assuming is due to a delay of the API to fetch the VOD stream and add to the mixer, however this delay pretty much makes the above process unusable.
This is due to a long keyframe interval in file. You should reencode file to set a stable keyframe interval, for example 2 seconds:
Code:
ffmpeg -i video.mp4 -c:v libx264 -preset ultrafast -g 60 -filter:v fps=30 -c:a aac -ar 48000 -strict -2 video-fixed.mp4
In this case the delay will be no more than 2 seconds.
 

Luca

Member
Hi Max

Thank you for your response

To comment to your response

Good day.

First, for restreaming it is recommended to start VOD files using REST API: VOD capture management with REST API
Thank you, I will try with this and see if it speeds up the process

This is due to a long keyframe interval in file. You should reencode file to set a stable keyframe interval, for example 2 seconds:
Code:
ffmpeg -i video.mp4 -c:v libx264 -preset ultrafast -g 60 -filter:v fps=30 -c:a aac -ar 48000 -strict -2 video-fixed.mp4
In this case the delay will be no more than 2 seconds.
Users will be uploading their own MP4 files to the platform and the formats(whilst still being MP4) will have different keyframe intervals and other options so having to re-encode each time is not an option, would you have any other suggestion please?

Also, any plan in development to be able to pause and restart a video stream, right now it is not very clear to me how I can add a video to the mixer and have it start at the same time, or(if a mistake is made) how can I restart the video from the beginning.

Thank you

Luca
 
Last edited:

Max

Administrator
Staff member
Users will be uploading their own MP4 files to the platform and the formats(whilst still being MP4) will have different keyframe intervals and other options so having to re-encode each time is not an option, would you have any other suggestion please?
You can post-process the file after user has uploaded it, this is one-time operation.
The alternative is the stream transcoding to equalize gop:
- start VOD file capture
- start transcoder for the VOD stream: Transcoding management with REST API
- play the transcoded stream
But realtime transcoding requires a lot of server resources (at least 1 CPU core per 2 720p streams, or 2 CPU cores per 1 1080p stream), so post processing after uploading seems to be more suitable solution.
Also, any plan in development to be able to pause and restart a video stream, right now it is not very clear to me how I can add a video to the mixer and have it start at the same time, or(if a mistake is made) how can I restart the video from the beginning.
Any stream on WCS is realtime, so there is no rewind capacities unless to stop and restart VOD stream again.
Also you cannot pause a realtime stream. As workaround, you can play the VOD stream as HLS, in this case HLS player in browser should care about playback pausing (all the chunks should be cached by cleints browser of course).
 
Top