ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lavAzza on January 09, 2021, 08:24:40 AM

Title: Pano video and ExifTool
Post by: lavAzza on January 09, 2021, 08:24:40 AM
Hello.
I found that 360 video players and YouTube need this metadata for panorama videos:
<?xml version="1.0"?><rdf:SphericalVideo
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/"><GSpherical:Spherical>true</GSpherical:Spherical><GSpherical:Stitched>true</GSpherical:Stitched><GSpherical:StitchingSoftware>Spherical Metadata Tool</GSpherical:StitchingSoftware><GSpherical:ProjectionType>equirectangular</GSpherical:ProjectionType></rdf:SphericalVideo>

And it is not work with "True", only with "true". I.e. I import metadata with
exiftool -tagsfromfile pano.xml -all:all pano.mp4
then I change "True" to "true" in the mp4 file with notepad++ and after that I can view panoramic video in VLC or upload to YouTube.
Is there way to import xml data without any changes?
Thank you.
Title: Re: Pano video and ExifTool
Post by: Phil Harvey on January 09, 2021, 08:45:18 AM
I hate stupid inflexible applications like this.  From the Adobe XMP specification:

    8.2.1.1 Boolean
    Boolean values shall be "True" or "False".

I'll have to think about how to deal with this.

Is this XMP or XML?  How are you writing this?

- Phil
Title: Re: Pano video and ExifTool
Post by: lavAzza on January 09, 2021, 09:32:19 AM
This xml I found here https://stackoverflow.com/questions/57439725/injecting-360-metadata-into-an-mp4-file
Metadata description I found here https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md
Google recommend use this metadata injector for 360 video https://github.com/google/spatial-media/releases/tag/v2.0
And it inject metadata with "true", I compared the same file with ExifTool and Spatial Media Metadata Injector injections, difference is only "T" letter.
Title: Re: Pano video and ExifTool
Post by: Phil Harvey on January 09, 2021, 09:46:55 AM
ExifTool can inject XMP as a block using "-xmp<=file.xmp".  When you do this the XMP is copied verbatim.  You can use this feature to work around the problem with the current version of ExifTool.

If you write individual tags using arguments like -spherical=true, then Exiftool will change this to uppercase "True" when writing.  But I need to think about how best to work around this.  Maybe what I need to have two different boolean types, and change the type used in the GSpherical XMP to use the lower-case version. :(

- Phil
Title: Re: Pano video and ExifTool
Post by: lavAzza on January 10, 2021, 01:47:59 AM
Thank you for reply. I was tried to make exiftool -xmp<=pano.xml pano.mp4 but it is not work for me. I think I need to convert xml to xmp format, I will learn how to do that.
Title: Re: Pano video and ExifTool
Post by: Phil Harvey on January 10, 2021, 12:04:00 PM
Quote from: lavAzza on January 10, 2021, 01:47:59 AM
exiftool -xmp<=pano.xml pano.mp4 but it is not work for me. I think I need to convert xml to xmp format, I will learn how to do that.

Also you need quotes around the argument with "<":

exiftool "-xmp<=pano.xml" pano.mp4

- Phil
Title: Re: Pano video and ExifTool
Post by: lavAzza on January 10, 2021, 05:13:19 PM
Ok, I tried to import xmp, it is indeed imported unchanged. Unfortunately, this does not work either. Or I did the wrong xmp. Apps do not recognize videos as panoramic. I do not understand xmp and xml, but could there be a problem that the metadata description https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md  (https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md) says that the metadata must be in xml format?
One of my xmp:
<x:xmpmeta>
   <rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:SphericalVideo
      xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/">
         <GSpherical:Spherical>true</GSpherical:Spherical>
         <GSpherical:Stitched>true</GSpherical:Stitched>
         <GSpherical:StitchingSoftware>Spherical Metadata Tool</GSpherical:StitchingSoftware>
         <GSpherical:ProjectionType>equirectangular</GSpherical:ProjectionType>
      </rdf:SphericalVideo>
   </rdf:RDF>
</x:xmpmeta>
Title: Re: Pano video and ExifTool
Post by: Phil Harvey on January 10, 2021, 09:28:34 PM
I have located a spherical video sample.  The XML (it is XML) is stored in the directory that Exiftool calls (unsurprisingly) SphericalVideoXML.  Unfortunately this is stored a the Track level (https://exiftool.org/TagNames/QuickTime.html#Track), so ExifTool can not write this.  ExifTool currently writes only file-level metadata to MP4 videos.

- Phil

Edit: Fixed link.  Thanks StarGeek.

Edit2: Strikeout incorrect statement.  I forgot that I added the ability to write GSpherical tags in the video track.  ExifTool 11.54 (July 2019) or later has this ability.
Title: Re: Pano video and ExifTool
Post by: StarGeek on January 10, 2021, 11:56:13 PM
I think you mean this link (https://exiftool.org/TagNames/QuickTime.html#Track).
Title: Re: Pano video and ExifTool
Post by: lavAzza on January 11, 2021, 02:20:38 AM
Ok, thank you.
I solved my problem using a python script https://github.com/google/spatial-media
python spatialmedia -i pano.mp4 pano_out.mp4
Works for both Win and Linux.
Title: Re: Pano video and ExifTool
Post by: ThatKeith on December 20, 2023, 12:16:21 PM
I apologise for reviving an old thread, but does anyone have a known-valid sample of spatial media XML that could be shared? I'm getting nowhere writing my own (and using exiftool "-xmp<=pano.xml" pano.mp4 in Terminal, with filenames/paths adjusted as necessary). Having a known-working, injectable-by-exiftool sample would be a huge help!

-Keith