Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
@ 2022-06-12 19:48 Steven Hartland
  2022-06-19 20:18 ` Marton Balint
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Hartland @ 2022-06-12 19:48 UTC (permalink / raw)
  To: ffmpeg-devel

Remove return after copying extradata as this prevents metadata
being duplicated correctly.

Signed-off-by: Steven Hartland <stevenmhartland@gmail.com>
---
 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-06-12 19:48 [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata Steven Hartland
@ 2022-06-19 20:18 ` Marton Balint
  2022-07-02 10:44   ` Steven Hartland
  0 siblings, 1 reply; 9+ messages in thread
From: Marton Balint @ 2022-06-19 20:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



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 <stevenmhartland@gmail.com>
> ---
> 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-06-19 20:18 ` Marton Balint
@ 2022-07-02 10:44   ` Steven Hartland
  2022-07-02 10:47     ` Steven Hartland
  2022-07-03 13:42     ` Nicolas George
  0 siblings, 2 replies; 9+ messages in thread
From: Steven Hartland @ 2022-07-02 10:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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 <cus@passwd.hu> 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 <stevenmhartland@gmail.com>
> > ---
> > 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-02 10:44   ` Steven Hartland
@ 2022-07-02 10:47     ` Steven Hartland
  2022-07-03 13:42     ` Nicolas George
  1 sibling, 0 replies; 9+ messages in thread
From: Steven Hartland @ 2022-07-02 10:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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 <stevenmhartland@gmail.com>
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 <cus@passwd.hu> 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 <stevenmhartland@gmail.com>
>> > ---
>> > 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-02 10:44   ` Steven Hartland
  2022-07-02 10:47     ` Steven Hartland
@ 2022-07-03 13:42     ` Nicolas George
  2022-07-03 13:47       ` Andreas Rheinhardt
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas George @ 2022-07-03 13:42 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1329 bytes --]

Steven Hartland (12022-07-02):
> 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.

> I believe the reason for the failure is that this early return prevents the
> metadata from being preserved.

You are trying to trick concat into merging files with different streams
and match streams between them. It is not how concat is designed to
work, it might work in your particular test case but will not work in
more complex cases and will break other use cases.

For example, with your change, if you concatenate a file with metadata
"start_time=12:00" and another with "start_time=12:01", it will generate
a file with both metadata entries instead of just the first one as would
be desirable.

Implementing your feature is not completely trivial: look how it is done
for subtitles streams in DVD structures. The concat stream defines all
the streams it expects to find in the file and specifies a condition to
match them, "exact_stream_id".

> On Sun, 19 Jun 2022 at 21:18, Marton Balint <cus@passwd.hu> wrote:

Please remember that top-posting is forbidden on this mailing-list. If
you do not know what it mean, look it up.

Regards,

-- 
  Nicolas George

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-03 13:42     ` Nicolas George
@ 2022-07-03 13:47       ` Andreas Rheinhardt
  2022-07-03 13:49         ` Nicolas George
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Rheinhardt @ 2022-07-03 13:47 UTC (permalink / raw)
  To: ffmpeg-devel

Nicolas George:
> Steven Hartland (12022-07-02):
>> 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.
> 
>> I believe the reason for the failure is that this early return prevents the
>> metadata from being preserved.
> 
> You are trying to trick concat into merging files with different streams
> and match streams between them. It is not how concat is designed to
> work, it might work in your particular test case but will not work in
> more complex cases and will break other use cases.
> 
> For example, with your change, if you concatenate a file with metadata
> "start_time=12:00" and another with "start_time=12:01", it will generate
> a file with both metadata entries instead of just the first one as would
> be desirable.
> 

Actually, the newer entry will overwrite the older entry; if you want
multiple keys with the same value, you have to use the AV_DICT_MULTIKEY
flag.

- Andreas
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-03 13:47       ` Andreas Rheinhardt
@ 2022-07-03 13:49         ` Nicolas George
  2022-07-04 22:33           ` Steven Hartland
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas George @ 2022-07-03 13:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 566 bytes --]

Andreas Rheinhardt (12022-07-03):
> > For example, with your change, if you concatenate a file with metadata
> > "start_time=12:00" and another with "start_time=12:01", it will generate
> > a file with both metadata entries instead of just the first one as would
> > be desirable.

> Actually, the newer entry will overwrite the older entry; if you want
> multiple keys with the same value, you have to use the AV_DICT_MULTIKEY
> flag.

I stand corrected, thanks. This is still not the most logical behavior,
though.

Regards,

-- 
  Nicolas George

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-03 13:49         ` Nicolas George
@ 2022-07-04 22:33           ` Steven Hartland
  2022-07-14 21:46             ` Steven Hartland
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Hartland @ 2022-07-04 22:33 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

I'm not sure we're on the same page, so let me try and clarify.

The files have multiple tracks, the standard audio and video and 3 metadata
tracks. I'm using the command line option -map 0:m:handler_name:"<name>" to
identify the tracks to copy. Given a single file this works as expected,
but as soon as concat has multiple files the track metadata is lost and the
handler_name match fails due to this early return.

Each of the tracks I'm selected are able to be concatenated just fine, much
like the a/v tracks. It's not about the file metadata, it's the track
metadata which is needed for track identification which I'm looking to
preserve.

Does that make sense?

   Regards
   Steve

On Sun, 3 Jul 2022 at 14:50, Nicolas George <george@nsup.org> wrote:

> Andreas Rheinhardt (12022-07-03):
> > > For example, with your change, if you concatenate a file with metadata
> > > "start_time=12:00" and another with "start_time=12:01", it will
> generate
> > > a file with both metadata entries instead of just the first one as
> would
> > > be desirable.
>
> > Actually, the newer entry will overwrite the older entry; if you want
> > multiple keys with the same value, you have to use the AV_DICT_MULTIKEY
> > flag.
>
> I stand corrected, thanks. This is still not the most logical behavior,
> though.
>
> Regards,
>
> --
>   Nicolas George
> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata
  2022-07-04 22:33           ` Steven Hartland
@ 2022-07-14 21:46             ` Steven Hartland
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Hartland @ 2022-07-14 21:46 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Any thoughts on my previous reply?

On Mon, 4 Jul 2022 at 23:33, Steven Hartland <stevenmhartland@gmail.com>
wrote:

> I'm not sure we're on the same page, so let me try and clarify.
>
> The files have multiple tracks, the standard audio and video and 3
> metadata tracks. I'm using the command line option -map
> 0:m:handler_name:"<name>" to identify the tracks to copy. Given a single
> file this works as expected, but as soon as concat has multiple files the
> track metadata is lost and the handler_name match fails due to this early
> return.
>
> Each of the tracks I'm selected are able to be concatenated just fine,
> much like the a/v tracks. It's not about the file metadata, it's the track
> metadata which is needed for track identification which I'm looking to
> preserve.
>
> Does that make sense?
>
>    Regards
>    Steve
>
> On Sun, 3 Jul 2022 at 14:50, Nicolas George <george@nsup.org> wrote:
>
>> Andreas Rheinhardt (12022-07-03):
>> > > For example, with your change, if you concatenate a file with metadata
>> > > "start_time=12:00" and another with "start_time=12:01", it will
>> generate
>> > > a file with both metadata entries instead of just the first one as
>> would
>> > > be desirable.
>>
>> > Actually, the newer entry will overwrite the older entry; if you want
>> > multiple keys with the same value, you have to use the AV_DICT_MULTIKEY
>> > flag.
>>
>> I stand corrected, thanks. This is still not the most logical behavior,
>> though.
>>
>> Regards,
>>
>> --
>>   Nicolas George
>> _______________________________________________
>> 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".

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-14 21:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 19:48 [FFmpeg-devel] [PATCH] avformat/concat: fix missing metadata Steven Hartland
2022-06-19 20:18 ` Marton Balint
2022-07-02 10:44   ` Steven Hartland
2022-07-02 10:47     ` Steven Hartland
2022-07-03 13:42     ` Nicolas George
2022-07-03 13:47       ` Andreas Rheinhardt
2022-07-03 13:49         ` Nicolas George
2022-07-04 22:33           ` Steven Hartland
2022-07-14 21:46             ` Steven Hartland

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git