<p>you can try something like this if you just want to transcode instead of writing metadata freshly into the file</p>
<pre><code>sudo ffmpeg -i 360video.MP4 -vcodec libx264 -strict unofficial -vprofile high  -acodec aac -f mp4  another.mp4
</code></pre>

CC BY-SA 4.0
2020-07-20T08:33:24.340Z
there is no reason to use `sudo` here.
polemon
CC BY-SA 4.0
2020-06-18T12:11:44.640Z
2020-06-18T12:11:44.640Z
Ram
<p>I'm working on a library that injects/embeds/writes metadata into a <code>.mp4</code> file to allow the video to be displayed correctly as a 360 video. The input file is a standard <code>.mp4</code> file in the equirectangular format which I need to inject the proper metadata to get it to display as a 360 video. I know tools like Google's <a href="https://github.com/google/spatial-media" rel="nofollow noreferrer">Spatial Media Tool</a> exist but if possible I would like to do it with FFmpeg.</p>

<p>The metadata injected by the Spatial Media tool looks like this and is what I am trying to achieve: </p>

<pre><code>&lt;?xml version="1.0"?&gt;&lt;rdf:SphericalVideo
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/"&gt;&lt;GSpherical:Spherical&gt;true&lt;/GSpherical:Spherical&gt;&lt;GSpherical:Stitched&gt;true&lt;/GSpherical:Stitched&gt;&lt;GSpherical:StitchingSoftware&gt;Spherical Metadata Tool&lt;/GSpherical:StitchingSoftware&gt;&lt;GSpherical:ProjectionType&gt;equirectangular&lt;/GSpherical:ProjectionType&gt;&lt;/rdf:SphericalVideo&gt;
</code></pre>

<p>These are all the things I have tried which did not work: </p>

<h2>Method 1</h2>

<pre><code>ffmpeg -i input.mp4 -movflags use_metadata_tags -metadata Spherical=true -metadata Stitched=true -metadata ProjectionType=equirectangular -metadata StitchingSoftware=StreetviewJourney -codec copy output.mp4
</code></pre>

<p>I have tried many variations of it like adding <code>GSpherical:</code> and <code>xmp:</code> to the metadata tag.</p>

<h2>Method 2</h2>

<p>When I extract the metadata using ffmpeg it contains the spherical tag in the logs but not when I output it to a ffmetadata file. This was the command I used: <code>ffmpeg -i injected.mp4 -map_metadata -1 -f ffmetadata data.txt</code></p>

<p>This is the output of the log:</p>

<pre><code> fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)
</code></pre>

<h2>Method 3</h2>

<p>I also tried to get the metadata using this command: <code>ffprobe -v error -select_streams v:0 -show_streams -of default=noprint_wrappers=1 injected.mp4</code></p>

<p>This was the logs it outputted:</p>

<pre><code>TAG:handler_name=VideoHandler
side_data_type=Spherical Mapping
projection=equirectangular
yaw=0
pitch=0
roll=0
</code></pre>

<p>I then tried to use this command but it didn't work: </p>

<pre><code>ffmpeg -i chapmanspeak.mp4 -movflags use_metadata_tags -metadata side_metadata_type="Spherical Mapping" -metadata projection=equirectangular -metadata yaw=0 -metadata pitch=0 -metadata roll=0 -codec copy output.mp4
</code></pre>

<video><ffmpeg><mp4><metadata>
Injecting/embedding/adding/writing metadata to a .mp4 file so it's recognised as 360
TrueCP5
# Injecting/embedding/adding/writing metadata to a .mp4 file so it's recognised as 360

(Asked by: username_0 on 2019-08-14)

I'm working on a library that injects/embeds/writes metadata into a .mp4 file to allow the video to be displayed correctly as a 360 video. The input file is a standard .mp4 file in the equirectangular format which I need to inject the proper metadata to get it to display as a 360 video. I know tools like Google's Spatial Media Tool exist but if possible I would like to do it with FFmpeg.
The metadata injected by the Spatial Media tool looks like this and is what I am trying to achieve: 
truetrueSpherical Metadata Toolequirectangular

These are all the things I have tried which did not work: 
Method 1
ffmpeg -i input.mp4 -movflags use_metadata_tags -metadata Spherical=true -metadata Stitched=true -metadata ProjectionType=equirectangular -metadata StitchingSoftware=StreetviewJourney -codec copy output.mp4

I have tried many variations of it like adding GSpherical: and xmp: to the metadata tag.
Method 2
When I extract the metadata using ffmpeg it contains the spherical tag in the logs but not when I output it to a ffmetadata file. This was the command I used: ffmpeg -i injected.mp4 -map_metadata -1 -f ffmetadata data.txt
This is the output of the log:
 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)

Method 3
I also tried to get the metadata using this command: ffprobe -v error -select_streams v:0 -show_streams -of default=noprint_wrappers=1 injected.mp4
This was the logs it outputted:
TAG:handler_name=VideoHandler
side_data_type=Spherical Mapping
projection=equirectangular
yaw=0
pitch=0
roll=0

I then tried to use this command but it didn't work: 
ffmpeg -i chapmanspeak.mp4 -movflags use_metadata_tags -metadata side_metadata_type="Spherical Mapping" -metadata projection=equirectangular -metadata yaw=0 -metadata pitch=0 -metadata roll=0 -codec copy output.mp4

**Tags:** video, ffmpeg, mp4, metadata


---

## 1 answers

### Answer by username_1 on 2020-06-18. Score: 0

you can try something like this if you just want to transcode instead of writing metadata freshly into the file
sudo ffmpeg -i 360video.MP4 -vcodec libx264 -strict unofficial -vprofile high  -acodec aac -f mp4  another.mp4

> **Comments:**
> **username_2**: there is no reason to use `sudo` here.  

---

