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 9733843880 for ; Sat, 2 Jul 2022 10:48:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0F87A68B5C4; Sat, 2 Jul 2022 13:48:14 +0300 (EEST) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DDC8680201 for ; Sat, 2 Jul 2022 13:48:07 +0300 (EEST) Received: by mail-ej1-f45.google.com with SMTP id pk21so8258478ejb.2 for ; Sat, 02 Jul 2022 03:48:07 -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=AtSLw3w4IdecP43M19tLGT9jk6dwF6vA5nHUNuu9ujE=; b=aIfV/7t0ezMea2m4AILr1ZC1cXE4HInpS8oNbPio9WpmnPHXzt7MLg/AR8lYcvcjL4 MWtPhwk1PfxxEqwXKiXpICkVo7x532kAjGeO0OWqRva1mE2te1jVUtBGhybqF0aKIM2a mSpRoTeU57Lis8jIts1856HyYkZ7HHbUVqOoZVu4/7ypcd6enwcBjVTF2AYOPa9+cdMz 8GWf07IztVxsOdozEQ/Lv+OkyymWmtqdJm3mzOWHKUdzxS3VHFOI9Jqi/oyvIvJ+WA/m N/YfSW+P/TDh3JA9Q69Ny5P+TJpkT/bF67H5g9TUp1TZJJcKvLXgg+B0kxYC7x0BBRa6 NvQw== 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=AtSLw3w4IdecP43M19tLGT9jk6dwF6vA5nHUNuu9ujE=; b=Te6gCWFBgeOcLr520fl/JvQRKko86ASbCbBj2h3NJ8Yi4k2TjYlGqwmM8DgzhhGoi/ pYyXUmVuk4ZA4Vu+domP/p1rb78eRDcSmghap09vmf9Q1bdlCxpmOwkTBbqTawk/8ZdU SgnmgguM88v/1h3GFmddaCg0eQVeDGOLBMUkQFggfZxwq4WjL3l+BY2ArZSGf22BUyH+ CXGCCNQlhIQkdEiAN9Scymn8rFEnWq+OwA88A7HdBPuKydS7Gg/XRC5FCbtCTm5t+/Eq iXy8bEfcXoEtUqWnUiwU9YzIxnAU36I4ghruR9ubiJpL2CyRNKQI3W1O6zMTZxdV/F7V 8gpQ== X-Gm-Message-State: AJIora/EvHPSkYxJ4ZEtMX7icSJo0rZzROcOp322mWymE2yZ8CwTHSd9 UQtNCE5S1dA8oIlbOo6cYz+xV8tENyyPm1vkzjykSdg0 X-Google-Smtp-Source: AGRyM1vsq2AHYLdQiVPkJoOLZJh9bLdX7x9qgxeDGRx1k6u7wUicS8wTM3TKMy8gWZQTxo03KC59xWdov0cZpdsTmOs= X-Received: by 2002:a17:906:4fc6:b0:722:e730:2355 with SMTP id i6-20020a1709064fc600b00722e7302355mr18446988ejw.50.1656758886444; Sat, 02 Jul 2022 03:48:06 -0700 (PDT) MIME-Version: 1.0 References: <26b9554f-38d0-af5e-a124-8848f57f25b3@passwd.hu> In-Reply-To: From: Steven Hartland Date: Sat, 2 Jul 2022 11:47:54 +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 should mention that this one of a few fixes needed to enable successful copying of GoPro metadata when using concat to join files, but wanted to start with from its size was the simplest one :) On Sat, 2 Jul 2022 at 11:44, Steven Hartland wrote: > 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".