Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trimming VIRB360 video loses the projection information #169

Closed
brisset opened this issue Jun 3, 2019 · 12 comments
Closed

Trimming VIRB360 video loses the projection information #169

brisset opened this issue Jun 3, 2019 · 12 comments
Labels
enhancement ffmpeg Problem resides in ffmpeg or usage of ffmpeg

Comments

@brisset
Copy link

brisset commented Jun 3, 2019

Hi,
I am looking for a lean and mean video cutter which does not reencode video, and came accross this project which looks promising. However when trying to trim a video shot on VIRB360 (360 video) it somehow loses the projection information, and the trimmed video is not displayed correctly.
Looking at the codec information in VLC I see that the projection information has been lost. Is there any way to preserve it? Attached 2 screenshots: codec information of original file, and codec information of trimmed file.
Thanks!
VIRB_original_codec_info

VIRB_trimmed_codec_info

@brisset
Copy link
Author

brisset commented Jun 3, 2019

Looks like this may be the reason:
https://stackoverflow.com/questions/44760588/preserving-side-data-information-for-360-video-transcoding-using-ffmpeg
Unfortunately it is not so easy to add a switch to the generated command line nor is there any options to set for ffmpeg invocation so I can't test it

@mifi mifi added enhancement ffmpeg Problem resides in ffmpeg or usage of ffmpeg labels Feb 16, 2020
@mifi
Copy link
Owner

mifi commented Feb 20, 2020

Now inside the help screen you can see a log of the last ffmpeg commands so you can copy and paste

@mifi mifi mentioned this issue Apr 7, 2020
@mifi
Copy link
Owner

mifi commented Apr 7, 2020

@mifi
Copy link
Owner

mifi commented Oct 5, 2020

Have you tried this?

https://stackoverflow.com/a/48147865/6519037

@mifi
Copy link
Owner

mifi commented Oct 5, 2020

I found a solution to this:

Go to Settings and enable the Experimental flag checkbox. Then 360 data should be included.

@dhilt
Copy link

dhilt commented Jun 7, 2021

@mifi I successfully split my 360-video into several 360-pieces with "Experimental flag" set to true, but I can't join that pieces into a new single source. The result is not 360. Looks like it loses some meta-data or something else when doing merge. How can I merge some 360-videos into one 360-piece?

@mifi
Copy link
Owner

mifi commented Nov 3, 2021

@dhilt did you try to enable the "Preserve original metadata when merging? (slow)" option? And I think "Preserve all MP4/MOV metadata" needs to be disabled

@mifi
Copy link
Owner

mifi commented Jan 18, 2022

I think this is somewhat related to #853

@mifi
Copy link
Owner

mifi commented Feb 8, 2022

So to summarise where the issue currently stands at:
With experimental flag and preserve metadata on a non-merge (-map_metadata 0) it does copy 360 side data

ffmpeg -i 360.mp4 -c copy -map 0 -map_metadata 0 -strict experimental -y 360-out.mp4
Output #0, mp4, to '360-out.mp4':
...
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 5760x2880, q=2-31, 177436 kb/s, 25 fps, 25 tbr, 25k tbn, 25k tbc (default)
    Metadata:
      creation_time   : 2021-09-08T15:48:50.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    Side data:
      stereo3d: 2D
      spherical: equirectangular (0.000000/0.000000/0.000000)

However if merging (concat), it does not copy the side data

ffmpeg -i 360.mp4 -f concat -safe 0 -i 360.txt -c copy -map 1 -map_metadata 0 -strict experimental -y 360-out.mp4
# even when explicitly specifying the metadata for "global" and "streams":
ffmpeg -f concat -safe 0 -i 360.txt -i 360.mp4 -strict experimental -c copy -map 0 -map_metadata:g 1:g -map_metadata:s 1:s -strict experimental -y 360-out.mp4
Output #0, mp4, to '360-out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2021-09-08T15:48:50.000000Z
    encoder         : Lavf58.76.100
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 5760x2880, q=2-31, 177436 kb/s, 25 fps, 25 tbr, 25k tbn, 25k tbc
    Metadata:
      creation_time   : 2021-09-08T15:48:50.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 130 kb/s
    Metadata:
      creation_time   : 2021-09-08T15:48:50.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]

also: google/spatial-media#226

@mifi
Copy link
Owner

mifi commented Feb 8, 2022

Ok I found that ffmpeg currently doesn't support it when concatenating files:

https://stackoverflow.com/questions/61701335/how-do-i-preserve-side-data-when-concatenating-files-in-ffmpeg

BUT I found that exiftool seems to support it, so I'm considering adding it to losslesscut:
https://stackoverflow.com/a/71038003/6519037

@dhilt
Copy link

dhilt commented Feb 9, 2022

That's great! BTW I did merge with google spatialmedia.

@mifi
Copy link
Owner

mifi commented Feb 12, 2022

Will track in #1027, so I'll close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ffmpeg Problem resides in ffmpeg or usage of ffmpeg
Projects
None yet
Development

No branches or pull requests

3 participants