obs-ffmpeg: Native SRT/RIST for mpegts output
Currently the ffmpeg_mpegts_muxer output is integrated with ffmpeg-mux. Both use obs native encoders in contrast with obs-ffmpeg-output which relies on avcodec library. This allowed easy implementation of SRT, RIST & HLS protocols through avformat library. The main drawback is that obs-ffmpeg-mux exe doesn't allow for easy debugging nor logging of the protocols. It was written initially as a separate binary designed for recording so that if obs fails for some reason, the recording can still terminate gracefully. In this commit the ffmpeg_mpegts_muxer is rewritten so that a pipe to the ffmpeg-mux binary is not used any more. The muxing to mpegts is still delegated to avformat. But it can be traced more easily in all its steps. Also the protocol part for SRT & RIST is implemented natively. Custom avio_contexts for SRT & RIST are used to that end. This allows to pass our own implementation of librist and libsrt libraries instead of relying on avformat. This is very advantageous : - this allows better logging. - this allows better bug fixing and maintainance without having to rely on hypothetical upstream fixes. One immediate bonus of native implementation is that fixes bugs which were not previously fixable. Fixes: SRT & RIST auto-reconnect partly broken #6749 Fixes: SRT: OBS unusable and uncloseable after starting stream to invalid srt server #5791 Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -36,12 +36,6 @@ static const char *ffmpeg_mux_getname(void *type)
|
||||
return obs_module_text("FFmpegMuxer");
|
||||
}
|
||||
|
||||
static const char *ffmpeg_mpegts_mux_getname(void *type)
|
||||
{
|
||||
UNUSED_PARAMETER(type);
|
||||
return obs_module_text("FFmpegMpegtsMuxer");
|
||||
}
|
||||
|
||||
static inline void replay_buffer_clear(struct ffmpeg_muxer *stream)
|
||||
{
|
||||
while (stream->packets.size > 0) {
|
||||
@@ -898,30 +892,6 @@ static int connect_time(struct ffmpeg_muxer *stream)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ffmpeg_mpegts_mux_connect_time(void *data)
|
||||
{
|
||||
struct ffmpeg_muxer *stream = data;
|
||||
/* TODO */
|
||||
return connect_time(stream);
|
||||
}
|
||||
|
||||
struct obs_output_info ffmpeg_mpegts_muxer = {
|
||||
.id = "ffmpeg_mpegts_muxer",
|
||||
.flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_MULTI_TRACK |
|
||||
OBS_OUTPUT_SERVICE,
|
||||
.encoded_video_codecs = "h264;av1",
|
||||
.encoded_audio_codecs = "aac",
|
||||
.get_name = ffmpeg_mpegts_mux_getname,
|
||||
.create = ffmpeg_mux_create,
|
||||
.destroy = ffmpeg_mux_destroy,
|
||||
.start = ffmpeg_mux_start,
|
||||
.stop = ffmpeg_mux_stop,
|
||||
.encoded_packet = ffmpeg_mux_data,
|
||||
.get_total_bytes = ffmpeg_mux_total_bytes,
|
||||
.get_properties = ffmpeg_mux_properties,
|
||||
.get_connect_time_ms = ffmpeg_mpegts_mux_connect_time,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static const char *replay_buffer_getname(void *type)
|
||||
|
Reference in New Issue
Block a user