diff mbox series

[FFmpeg-devel,14/20] fftools/ffmpeg_mux_init: drop a duplicated block in copy_metadata()

Message ID 20221018123701.25002-14-anton@khirnov.net
State Accepted
Commit 3c7dd5ed37da6d2de06c4850de5a319ca9cdd47f
Headers show
Series [FFmpeg-devel,01/20] fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.c | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Oct. 18, 2022, 12:36 p.m. UTC
It does the same thing as the block right below it.
---
 fftools/ffmpeg_mux_init.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Michael Niedermayer Oct. 18, 2022, 9:51 p.m. UTC | #1
On Tue, Oct 18, 2022 at 02:36:55PM +0200, Anton Khirnov wrote:
> It does the same thing as the block right below it.
> ---
>  fftools/ffmpeg_mux_init.c | 10 ----------
>  1 file changed, 10 deletions(-)

This seems to make a difference for
ffmpeg -i meta.flac -map_metadata:s -1 -vcodec mpeg4 -t 0.1  -y /tmp/tmp3x.mkv

The metadata in meta.flac is a bit odd though

Input #0, flac, from '/home/michael/videos/meta.flac':
  Metadata:
    al              : Hyper fast Audio and Video encoder
                    : usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
                    : 
                    : Main options:
....
                    : -param1            <double> E.V.. scaler param 1
    x               : öäü?ß^x²€
    encoder         : Lavf54.0.100
  Duration: 00:03:07.66, start: 0.000000, bitrate: 706 kb/s
  Stream #0:0: Audio: flac, 48000 Hz, stereo, s16
At least one output file must be specified



[...]
Anton Khirnov Nov. 8, 2022, 12:46 p.m. UTC | #2
Quoting Michael Niedermayer (2022-10-18 23:51:22)
> On Tue, Oct 18, 2022 at 02:36:55PM +0200, Anton Khirnov wrote:
> > It does the same thing as the block right below it.
> > ---
> >  fftools/ffmpeg_mux_init.c | 10 ----------
> >  1 file changed, 10 deletions(-)
> 
> This seems to make a difference for
> ffmpeg -i meta.flac -map_metadata:s -1 -vcodec mpeg4 -t 0.1  -y /tmp/tmp3x.mkv
> 
> The metadata in meta.flac is a bit odd though
> 
> Input #0, flac, from '/home/michael/videos/meta.flac':
>   Metadata:
>     al              : Hyper fast Audio and Video encoder
>                     : usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
>                     : 
>                     : Main options:
> ....
>                     : -param1            <double> E.V.. scaler param 1
>     x               : öäü?ß^x²€

Is this before or after?

If I'm reading the code correctly, no metadata should be copied after my
patch, which IMO is more consistent with the docs.
Anton Khirnov Nov. 14, 2022, 9:24 a.m. UTC | #3
Will push the rest of this set soonish if noone has further comments.
Michael Niedermayer Nov. 14, 2022, 10:21 p.m. UTC | #4
On Tue, Nov 08, 2022 at 01:46:57PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2022-10-18 23:51:22)
> > On Tue, Oct 18, 2022 at 02:36:55PM +0200, Anton Khirnov wrote:
> > > It does the same thing as the block right below it.
> > > ---
> > >  fftools/ffmpeg_mux_init.c | 10 ----------
> > >  1 file changed, 10 deletions(-)
> > 
> > This seems to make a difference for
> > ffmpeg -i meta.flac -map_metadata:s -1 -vcodec mpeg4 -t 0.1  -y /tmp/tmp3x.mkv
> > 
> > The metadata in meta.flac is a bit odd though
> > 
> > Input #0, flac, from '/home/michael/videos/meta.flac':
> >   Metadata:
> >     al              : Hyper fast Audio and Video encoder
> >                     : usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
> >                     : 
> >                     : Main options:
> > ....
> >                     : -param1            <double> E.V.. scaler param 1
> >     x               : öäü?ß^x²€
> 
> Is this before or after?
> 
> If I'm reading the code correctly, no metadata should be copied after my
> patch, which IMO is more consistent with the docs.

sorry for the delay, the metadata disappears as you describe after the patch

thx

[...]
diff mbox series

Patch

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index a471bbf469..9e0164ba19 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1455,16 +1455,6 @@  static int copy_metadata(const char *outspec, const char *inspec, AVFormatContex
     parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);
     parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
 
-    if (!ic) {
-        if (type_out == 'g' || !*outspec)
-            o->metadata_global_manual = 1;
-        if (type_out == 's' || !*outspec)
-            o->metadata_streams_manual = 1;
-        if (type_out == 'c' || !*outspec)
-            o->metadata_chapters_manual = 1;
-        return 0;
-    }
-
     if (type_in == 'g' || type_out == 'g')
         o->metadata_global_manual = 1;
     if (type_in == 's' || type_out == 's')