From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6152043878 for ; Sat, 2 Jul 2022 10:45:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B187968B8A8; Sat, 2 Jul 2022 13:44:57 +0300 (EEST) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE8A368B844 for ; Sat, 2 Jul 2022 13:44:50 +0300 (EEST) Received: by mail-ej1-f46.google.com with SMTP id d2so8253537ejy.1 for ; Sat, 02 Jul 2022 03:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ZixUZeF8Ef4OGplxMGBzsXyhk2k7W6CL/+c5Zc7KMpU=; b=nnEb4J2CkqsUKEJWc5Iq6CpdSK6zU6++0YfzrIKsA8kb8P6QE3fLT54NtBEVIJVTP4 FwhGsrUEFUfn+bHGFdqBRiOGhjcUpXbL09nLzK3rHnmkgX3QVszezr2V/wBeQpd+saaS /t4gWz7BOMj5WtBRM3CkGEVomPDanqrlmT4ArK4ZjZoVjSGl3BW5sXO0XKtAPk7if4cM BV2nwnHG963PMKiigxFHqAyWDpJm4ocyE3kDvPr4BL4f5KosJCMPKvu+proR2ucq8Ox0 v13FvMo11egsp7bMc9CV5hWut6kkG2m2sYaVoKCYOyn6QrqyHYwarkxm64ckMVvEJwHu VrRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ZixUZeF8Ef4OGplxMGBzsXyhk2k7W6CL/+c5Zc7KMpU=; b=ZeokIWRpqyurMPWEG8HH1FBVAJvqLkcWWie3bRVcxMWrXu2rqJTCmTG7Pn30jUpLMz qIAJwfxpy9bORY93nwMTutARozUR3b5FyMBrXhS8TMdJ6bJc6dKMJ9Ojq3/3IhjI2iX9 UOKXY31bLWTYRjGscw2r8pFL2VAyQsDzSH1aaORGD9jLA2l/XzPUWj/D9sKBTK1J2/OS vfe/PxIGVVYz059uVvgvl9DdEFhgaN/e7TwsG3Mna371sqWfIBIOk7+uus8cTw08/mTX fy8TYa217DGZhREYotXsN0qFqomlrta1cKGY7kp471IUU3WMhsrgTdls1BjEn2KX/BgC yjag== X-Gm-Message-State: AJIora/GURdhoIR4ecU79uIq0uBxU3VlCc0bvb9jTH8h/qdhXlXWdSuH JR0G9haDSCgH6kXamopZpxDXHiChOnOZNy/I2lhVxWLzZzc= X-Google-Smtp-Source: AGRyM1sGuVuZWXgDIRVLQxAK8FJpPYrq8lGIJH8WzemhPMQlBAkEQmg9/GcEXw33F4SFMOWe+drrpWIYeJVz4Y0+5pY= X-Received: by 2002:a17:906:3f02:b0:718:bdf7:790d with SMTP id c2-20020a1709063f0200b00718bdf7790dmr19224796ejj.479.1656758689949; Sat, 02 Jul 2022 03:44:49 -0700 (PDT) MIME-Version: 1.0 References: <26b9554f-38d0-af5e-a124-8848f57f25b3@passwd.hu> In-Reply-To: <26b9554f-38d0-af5e-a124-8848f57f25b3@passwd.hu> From: Steven Hartland Date: Sat, 2 Jul 2022 11:44:38 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: I'm using concat to join multiple files from a GoPro camera including the three metadata streams, with the early return it fails as the metadata stream information is missing so map fails. Example of the command line is: ffmpeg \ -y \ -safe 0 \ -f concat \ -i list.txt \ -c copy \ -c:v libx264 \ -vf scale=1920:1080 \ -crf 24 \ -copy_unknown \ -map_metadata 0 \ -movflags use_metadata_tags \ -map 0:v \ -map 0:a \ -map 0:m:handler_name:" GoPro TCD" \ -map 0:m:handler_name:" GoPro MET" \ -map 0:m:handler_name:" GoPro SOS" \ test/concat.mp4 Here is the error without the change: ffmpeg version N-107034-g77b529fbd2 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) configuration: --prefix=/home/steveh/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/steveh/ffmpeg_build/include --extra-ldflags=-L/home/steveh/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/steveh/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree libavutil 57. 25.100 / 57. 25.100 libavcodec 59. 32.102 / 59. 32.102 libavformat 59. 24.100 / 59. 24.100 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 40.100 / 8. 40.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x55be9e9aac00] Auto-inserting h264_mp4toannexb bitstream filter [concat @ 0x55be9e9a1140] Could not find codec parameters for stream 2 (Unknown: none): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [concat @ 0x55be9e9a1140] Could not find codec parameters for stream 4 (Unknown: none): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, concat, from 'list.txt': Duration: N/A, start: 0.000000, bitrate: 60098 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 59932 kb/s, 23.98 fps, 23.98 tbr, 24k tbn Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AVC vendor_id : [0][0][0][0] encoder : GoPro AVC encoder timecode : 15:38:07:03 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AAC vendor_id : [0][0][0][0] timecode : 15:38:07:03 Stream #0:2: Unknown: none Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 38 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro MET Stream #0:4: Unknown: none Stream map '0:m:handler_name: GoPro TCD' matches no streams. To ignore this, add a trailing '?' to the map. With this change it works as expected: ffmpeg version N-107034-g77b529fbd2 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) configuration: --prefix=/home/steveh/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/steveh/ffmpeg_build/include --extra-ldflags=-L/home/steveh/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/steveh/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree libavutil 57. 25.100 / 57. 25.100 libavcodec 59. 32.102 / 59. 32.102 libavformat 59. 24.100 / 59. 24.100 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 40.100 / 8. 40.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x557f730b3c00] Auto-inserting h264_mp4toannexb bitstream filter Input #0, concat, from 'list.txt': Duration: N/A, start: 0.000000, bitrate: 60108 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 59932 kb/s, 23.98 fps, 23.98 tbr, 24k tbn Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AVC vendor_id : [0][0][0][0] encoder : GoPro AVC encoder timecode : 15:38:07:03 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AAC vendor_id : [0][0][0][0] timecode : 15:38:07:03 Stream #0:2(eng): Data: none (tmcd / 0x64636D74) Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro TCD timecode : 15:38:07:03 Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 38 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro MET Stream #0:4(eng): Data: none (fdsc / 0x63736466), 9 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro SOS [mp4 @ 0x557f732f6240] You requested a copy of the original timecode track so timecode metadata are now ignored Output #0, mp4, to 'test/concat.mp4': Metadata: encoder : Lavf59.24.100 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59932 kb/s, 23.98 fps, 23.98 tbr, 24k tbn Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AVC vendor_id : [0][0][0][0] encoder : GoPro AVC encoder timecode : 15:38:07:03 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro AAC vendor_id : [0][0][0][0] timecode : 15:38:07:03 Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default) Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro TCD timecode : 15:38:07:03 Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 38 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro MET Stream #0:4(eng): Data: none (fdsc / 0x63736466), 9 kb/s Metadata: creation_time : 2022-05-31T15:39:02.000000Z handler_name : GoPro SOS Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy) Stream #0:3 -> #0:3 (copy) Stream #0:4 -> #0:4 (copy) Press [q] to stop, [?] for help frame= 24 fps= 16 q=-1.0 size= 768kB time=00:00:01.00 bitrate=6275.1kbits/s speed=0.668x ... I believe the reason for the failure is that this early return prevents the metadata from being preserved. On Sun, 19 Jun 2022 at 21:18, Marton Balint wrote: > > > On Sun, 12 Jun 2022, Steven Hartland wrote: > > > Remove return after copying extradata as this prevents metadata > > being duplicated correctly. > > The return there originated from commit > b24d6c53037aaaa20fbd59cbd25c392229450660 and seems very much intentional > to not overwrite stream parameters after every packet. > > So what is the issue you are trying to fix? Some parameters change after > the avformat_find_stream_info() returned? > > Regards, > Marton > > > > > Signed-off-by: Steven Hartland > > --- > > libavformat/concatdec.c | 1 - > > tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +- > > 2 files changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c > > index e57da59e04..11ed2bd4c3 100644 > > --- a/libavformat/concatdec.c > > +++ b/libavformat/concatdec.c > > @@ -182,7 +182,6 @@ static int copy_stream_props(AVStream *st, AVStream > > *source_st) > > } > > memcpy(st->codecpar->extradata, source_st->codecpar->extradata, > > source_st->codecpar->extradata_size); > > - return 0; > > } > > if ((ret = avcodec_parameters_copy(st->codecpar, > source_st->codecpar)) > > < 0) > > return ret; > > diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts > > b/tests/ref/fate/concat-demuxer-simple2-lavf-ts > > index 9603ca21d0..d98e8b71e1 100644 > > --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts > > +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts > > @@ -211,5 +211,5 @@ > > > video|1|171982|1.910911|168382|1.870911|3600|0.040000|17440|206988|__|MPEGTS > > Str > > > > > video|1|175582|1.950911|171982|1.910911|3600|0.040000|15019|224848|__|MPEGTS > > Stream ID|224 > > > > > -0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this > > is stream 0 > > > +0|mp2|unknown|audio|[3][0][0][0]|0x0003|fltp|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this > > is stream 0 > > > 1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this > > is stream 1|CPB properties|0|0|0|49152|-1 > > -- > > 2.25.1 > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".