From 624d02da9719a48c2604d505a9e3bf0355e57fe0 Mon Sep 17 00:00:00 2001 From: Nguyen Marc Date: Fri, 24 May 2024 16:33:46 +0200 Subject: [PATCH] fix(concat): fix mapping error (#37) --- video/concat/concat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/video/concat/concat.c b/video/concat/concat.c index 0e7b72f..8d90704 100644 --- a/video/concat/concat.c +++ b/video/concat/concat.c @@ -198,9 +198,10 @@ int concat(const char *output_file, size_t input_files_count, } stream_mapping[input_idx][i] = stream_index++; + const int out_stream_index = stream_mapping[input_idx][i]; fprintf(stderr, "Input %zu, mapping stream %d (%s) to output stream %d\n", input_idx, i, av_get_media_type_string(in_codecpar->codec_type), - stream_mapping[input_idx][i]); + out_stream_index); // Only create streams based on the first video. if (input_idx == 0) { @@ -228,9 +229,9 @@ int concat(const char *output_file, size_t input_files_count, } // Set to zero - dts_offset[i] = 0; - prev_dts[input_idx][i] = AV_NOPTS_VALUE; - prev_duration[input_idx][i] = 0; + dts_offset[out_stream_index] = 0; + prev_dts[input_idx][out_stream_index] = AV_NOPTS_VALUE; + prev_duration[input_idx][out_stream_index] = 0; } if (input_idx == 0) {