Skip to content

Instantly share code, notes, and snippets.

@mlouielu
Created July 5, 2018 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlouielu/6f32523fb612aa84ba69995fbd9c2828 to your computer and use it in GitHub Desktop.
Save mlouielu/6f32523fb612aa84ba69995fbd9c2828 to your computer and use it in GitHub Desktop.
$ ls
360_0926.MP4 gear360pano spatial-media tmp
# 將影片轉為魚眼圖片
$ ffmpeg -y -i 360_0926.MP4 -q:v 2 tmp/image%05d.jpg
# 將魚眼圖片轉為拼接圖片
$ find tmp -type f -name '*.jpg' | parallel --load 99% --noswap --memfree 500M --bar "gear360pano/gear360pano.sh -r -m -o tmp {} gear360pano/gear360video4096.pto"
# 將拼接圖片轉為影片
$ ffmpeg -y -f image2 -framerate 24/1 -i tmp/image%5d_pano.jpg -r "24/1" -s 4096:2048 -c:v libx265 -crf 18 tmp/video.mp4
# 擷取聲音
$ ffmpeg -y -i 360_0926.MP4 -vn -acodec copy tmp/audio.aac
# 合併聲音
$ ffmpeg -y -i tmp/video.mp4 -i tmp/audio.aac -c:v copy -c:a aac -strict experimental tmp/out.mp4
# Inject metadata
$ python spatial-media/spatialmedia -i tmp/out.mp4 tmp/out_inject.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment