Re: [FFmpeg-devel] avformat/mov : add support for read/write Adobe Alpha Udta

2018-03-20 Thread Michael Niedermayer
On Sun, Mar 11, 2018 at 01:43:16PM +0100, Martin Vignali wrote:
> > > +av_log(c->fc, AV_LOG_ERROR,
> > > +   "unknown value for ALFA udta (%llu)\n", alpha_val);
> >
> > the %llu looks wrong for the type
> >
> >
> >
> New patch in attach replacing %llu with %"PRIu64
> 
> Martin

>  mov.c |   25 +
>  1 file changed, 25 insertions(+)
> f3a63c8a1a96c720a35b4905d484a0a1dbc1754c  
> 0001-avformat-mov-add-support-for-Adobe-Alpha-metadata.patch
> From 7f64436a07a1ceb3fa56ddb8267c8c1b08e04617 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Sun, 11 Mar 2018 13:16:29 +0100
> Subject: [PATCH 1/3] avformat/mov : add support for Adobe Alpha metadata 
>  parsing
> 
> ---
>  libavformat/mov.c | 25 +
>  1 file changed, 25 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 51228f5df2..740f4d5faa 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -120,6 +120,29 @@ static int mov_metadata_int8_no_padding(MOVContext *c, 
> AVIOContext *pb,
>  return 0;
>  }
>  
> +/* Adobe Alpha metadata */
> +static int mov_metadata_alpha(MOVContext *c, AVIOContext *pb, unsigned len)
> +{
> +uint64_t alpha_val;
> +if (len != 10) {
> +av_log(c->fc, AV_LOG_ERROR,
> +   "invalid size for ALFA udta (%u bytes left, need %d)\n", len, 
> 10);
> +return AVERROR_INVALIDDATA;
> +}
> +avio_rb16(pb);
> +alpha_val = avio_rb64(pb);
> +
> +if (alpha_val == 0) {
> +return av_dict_set(>fc->metadata, "alpha", "straight", 0);
> +} else if (alpha_val == 4294967297) {
> +return av_dict_set(>fc->metadata, "alpha", "premult", 0);
> +} else {
> +av_log(c->fc, AV_LOG_ERROR,
> +   "unknown value for ALFA udta (%"PRIu64")\n", alpha_val);
> +return AVERROR_INVALIDDATA;
> +}
> +}

iam not objecting to this but i do not think that metadata is teh correct
place to ex/inport information about redefining the meaning of the alpha
channel

I think it should be handled similar to how other information about
pixel formats and colorspaces is handled

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/mov : add support for read/write Adobe Alpha Udta

2018-03-11 Thread Martin Vignali
> > +av_log(c->fc, AV_LOG_ERROR,
> > +   "unknown value for ALFA udta (%llu)\n", alpha_val);
>
> the %llu looks wrong for the type
>
>
>
New patch in attach replacing %llu with %"PRIu64

Martin


0001-avformat-mov-add-support-for-Adobe-Alpha-metadata.patch
Description: Binary data


0002-avformat-movenc-add-support-for-writing-alpha-metada.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/mov : add support for read/write Adobe Alpha Udta

2018-03-03 Thread Michael Niedermayer
On Sat, Mar 03, 2018 at 07:09:20PM +0100, Martin Vignali wrote:
> Hello,
> 
> Patch in attach add suport for reading ALFA udta
> set (at least), by Adobe Software
> and for writing it.
> 
> Theses two patch, can keep the original metadata when remuxing it
> And the user can force the value using -metadata alpha=
> In order to have the right alpha mode set when importing the mov file in
> Adobe Software.
> 
> //Force set alpha straight
> ./ffmpeg -i inputFile -vcodec copy -metadata alpha="straight" targetFile.mov
> 
> //Force set alpha premult
> ./ffmpeg -i inputFile -vcodec copy -metadata alpha="premult" targetFile.mov
> 
> Example of file with this metadata can be found here
> https://we.tl/dil4NvXMS0
> 
> Martin

>  mov.c |   25 +
>  1 file changed, 25 insertions(+)
> 91924208ccb90dbe2df6ee9c90a3f5de3e6454c9  
> 0004-avformat-mov-add-support-for-Adobe-Alpha-metadata-pa.patch
> From 1c281661acf7e72cb8aee6492680605cc01b75c7 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Sat, 3 Mar 2018 18:09:57 +0100
> Subject: [PATCH 4/5] avformat/mov : add support for Adobe Alpha metadata
>  parsing
> 
> ---
>  libavformat/mov.c | 25 +
>  1 file changed, 25 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f01116874c..867fb4a631 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -120,6 +120,29 @@ static int mov_metadata_int8_no_padding(MOVContext *c, 
> AVIOContext *pb,
>  return 0;
>  }
>  
> +/* Adobe Alpha metadata */
> +static int mov_metadata_alpha(MOVContext *c, AVIOContext *pb, unsigned len)
> +{
> +uint64_t alpha_val;
> +if (len != 10) {
> +av_log(c->fc, AV_LOG_ERROR,
> +   "invalid size for ALFA udta (%u bytes left, need %d)\n", len, 
> 10);
> +return AVERROR_INVALIDDATA;
> +}
> +avio_rb16(pb);
> +alpha_val = avio_rb64(pb);
> +
> +if (alpha_val == 0) {
> +return av_dict_set(>fc->metadata, "alpha", "straight", 0);
> +} else if (alpha_val == 4294967297) {
> +return av_dict_set(>fc->metadata, "alpha", "premult", 0);
> +} else {
> +av_log(c->fc, AV_LOG_ERROR,
> +   "unknown value for ALFA udta (%llu)\n", alpha_val);

the %llu looks wrong for the type


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel