PR #21801 opened by Rost Kurylo (rost.kurylo) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21801 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21801.patch
Previously only the stream list has been passed through to mpegts muxer, and the program layout, if any has been provided, was lost. This change copies the program table into the nested mepgts muxer when initializing rtp_mpegts. To test: ``` ffmpeg -re -stream_loop -1 -i <any_file_with_at_least_one_video_and_one_audio> -c:v copy -c:a copy -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -program title=Prog1:program_num=101:st=0:st=1 -program title=Prog2:program_num=102:st=2:st=3 -f rtp_mpegts 'rtp://127.0.0.1:5004' ``` Then probe with: ``` ffprobe rtp://127.0.0.1:5004 -show_programs -print_format json ``` Signed-off-by: Rost Kurylo <[email protected]> >From 168d22b0b1e367c55381cb98c3cb0dfb4fef0b1f Mon Sep 17 00:00:00 2001 From: Rost Kurylo <[email protected]> Date: Thu, 19 Feb 2026 10:05:10 -0800 Subject: [PATCH] avformat/rtp_mpegts: Pass-through program table to mpegts muxer Previously only the stream list has been passed through to mpegts muxer, and the program layout, if any has been provided, was lost. This change copies the program table into the nested mepgts muxer when initializing rtp_mpegts. Signed-off-by: Rost Kurylo <[email protected]> --- libavformat/rtpenc_mpegts.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index f9ff7e99cd..e7661ce880 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -85,6 +85,29 @@ static int rtp_mpegts_write_header(AVFormatContext *s) st->id = s->streams[i]->id; avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); } + for (i = 0; i < s->nb_programs; i++) { + AVProgram* program = av_new_program(mpegts_ctx, s->programs[i]->id); + if (!program) + goto fail; + program->id = s->programs[i]->id; + program->flags = s->programs[i]->flags; + program->discard = s->programs[i]->discard; + program->nb_stream_indexes = s->programs[i]->nb_stream_indexes; + program->stream_index = av_realloc_array(program->stream_index, program->nb_stream_indexes, sizeof(unsigned int)); + if (!program->stream_index) + goto fail; + memcpy(program->stream_index, s->programs[i]->stream_index, program->nb_stream_indexes * sizeof(unsigned int)); + av_dict_copy(&program->metadata, s->programs[i]->metadata, 0); + + program->program_num = s->programs[i]->program_num; + program->pmt_pid = s->programs[i]->pmt_pid; + program->pcr_pid = s->programs[i]->pcr_pid; + program->pmt_version = s->programs[i]->pmt_version; + program->start_time = s->programs[i]->start_time; + program->end_time = s->programs[i]->end_time; + program->pts_wrap_reference = s->programs[i]->pts_wrap_reference; + program->pts_wrap_behavior = s->programs[i]->pts_wrap_behavior; + } if ((ret = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0) goto fail; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
