[FFmpeg-devel] [PATCH 3/3 v2] mov: Export spherical information

James Almer jamrial at gmail.com
Thu Nov 17 00:57:05 EET 2016


On 11/16/2016 12:33 PM, Vittorio Giovara wrote:
> On Tue, Nov 15, 2016 at 10:09 PM, James Almer <jamrial at gmail.com> wrote:
>> On 11/15/2016 1:56 PM, Vittorio Giovara wrote:
>>> +static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>>> +{
>>> +    AVStream *st;
>>> +    MOVStreamContext *sc;
>>> +    enum AVStereo3DType type;
>>> +    int mode;
>>> +
>>> +    if (c->fc->nb_streams < 1)
>>> +        return 0;
>>> +
>>> +    st = c->fc->streams[c->fc->nb_streams - 1];
>>> +    sc = st->priv_data;
>>> +
>>> +    if (atom.size < 1) {
>>> +        av_log(c->fc, AV_LOG_ERROR, "Empty stereoscopic video box\n");
>>> +        return AVERROR_INVALIDDATA;
>>> +    }
>>> +
>>> +    mode = avio_r8(pb);
>>
>> If i'm reading the spec right, st3d is a FullBox so before the data you'll
>> have the box's version and flags (1 byte and 3 bytes respectively).
> 
> Oh I see, so I should check for version == 0 and read three bytes only
> instead of 4.
> 
>>> +        av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
>>> +        return 0;
>>> +    }
>>> +
>>> +    /* 16.16 fixed point */
>>> +    yaw   = avio_rb32(pb);
>>> +    pitch = avio_rb32(pb);
>>> +    roll  = avio_rb32(pb);
>>> +
>>> +    avio_skip(pb, size - 20);
>>> +
>>> +    size = avio_rb32(pb);
>>> +    if (size > atom.size)
>>> +        return AVERROR_INVALIDDATA;
>>> +
>>> +    tag = avio_rl32(pb);
>>
>> And all the possible cases for this one, except in here it seems to be 4 bytes for
>> version and four for flags.

In the end no, they apparently are also 1 byte version + 3 bytes flags.

>>
>> Does Google offer samples to confirm this?
> 
> Yep.
> 
> https://transfer.sh/WOegj/motherboard-cube-v2-metadata.mp4
> https://transfer.sh/31Zvg/motherboard-equirect-v1-metadata.mp4
> https://transfer.sh/tn1xe/motherboard-equirect-v2-metadata.mp4

Nice, thanks. Although it would have been better if they had some values other
than 0 for every spherical related field.

Do they also happen to offer webm samples with the elements detailed in this
spec?



More information about the ffmpeg-devel mailing list