Spec: https://developers.google.com/streetview/publish/camm-spec
The Lenovo Mirage camera launched recently and outputs this metadata track in its videos.
From 937a49d00139edfc8cc5eda9234c2b8afbaa4773 Mon Sep 17 00:00:00 2001 From: Erik Ackermann <k...@google.com> Date: Mon, 21 May 2018 11:42:04 -0700 Subject: [PATCH] Add support for Camera Motion Metadata ('camm') track. https://developers.google.com/streetview/publish/camm-spec --- libavcodec/avcodec.h | 1 + libavcodec/codec_desc.c | 6 ++++++ libavformat/isom.c | 1 + libavformat/mov.c | 2 ++ libavformat/movenc.c | 9 +++++++++ 5 files changed, 19 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fb0c6fae70..920b2b519a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -689,6 +689,7 @@ enum AVCodecID { * stream (only used by libavformat) */ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket + AV_CODEC_ID_CAMERA_MOTION_METADATA = 0x63616d6d, }; /** diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 79552a910d..31d0d82a53 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -3047,6 +3047,12 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("HDMV Text subtitle"), .props = AV_CODEC_PROP_TEXT_SUB, }, + { + .id = AV_CODEC_ID_CAMERA_MOTION_METADATA, + .type = AVMEDIA_TYPE_DATA, + .name = "camm", + .long_name = NULL_IF_CONFIG_SMALL("camera motion metadata"), + }, /* other kind of codecs and pseudo-codecs */ { diff --git a/libavformat/isom.c b/libavformat/isom.c index 2792371c25..44b303f687 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -69,6 +69,7 @@ const AVCodecTag ff_mp4_obj_type[] = { { AV_CODEC_ID_QCELP , 0xE1 }, { AV_CODEC_ID_MPEG4SYSTEMS, 0x01 }, { AV_CODEC_ID_MPEG4SYSTEMS, 0x02 }, + { AV_CODEC_ID_CAMERA_MOTION_METADATA, MKTAG('c', 'a', 'm', 'm') }, { AV_CODEC_ID_NONE , 0 }, }; diff --git a/libavformat/mov.c b/libavformat/mov.c index 1340bf3913..080b152c73 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2327,6 +2327,8 @@ FF_ENABLE_DEPRECATION_WARNINGS } } } + } else if (st->codecpar->codec_tag == MKTAG('c','a','m','m')) { + st->codecpar->codec_id = AV_CODEC_ID_CAMERA_MOTION_METADATA; } else { /* other codec type, just skip (rtp, mp4s ...) */ avio_skip(pb, size); diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d03d7906a1..8828efd898 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2177,6 +2177,12 @@ static int mov_write_stsd_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext mov_write_tmcd_tag(pb, track); else if (track->par->codec_tag == MKTAG('g','p','m','d')) mov_write_gpmd_tag(pb, track); + else if (track->par->codec_tag == MKTAG('c', 'a', 'm', 'm')) { + avio_wb32(pb, 16); /* size */ + avio_wl32(pb, track->par->codec_tag); /* tag */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* data reference index*/ + } return update_size(pb, pos); } @@ -2567,6 +2573,9 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra } else if (track->par->codec_tag == MKTAG('g','p','m','d')) { hdlr_type = "meta"; descr = "GoPro MET"; // GoPro Metadata + } else if (track->par->codec_tag == MKTAG('c','a','m','m')) { + hdlr_type = "meta"; + descr = "MetadataHandler"; } else { av_log(s, AV_LOG_WARNING, "Unknown hldr_type for %s, writing dummy values\n", -- 2.17.0.441.gb46fe60e1d-goog
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel