[FFmpeg-devel] avformat/mov : add support for read/write Adobe Alpha Udta
Michael Niedermayer
michael at niedermayer.cc
Sun Mar 4 01:33:09 EET 2018
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 <martin.vignali at gmail.com>
> 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(&c->fc->metadata, "alpha", "straight", 0);
> + } else if (alpha_val == 4294967297) {
> + return av_dict_set(&c->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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180304/65b08dee/attachment.sig>
More information about the ffmpeg-devel
mailing list