Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
Insta360VRutils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sysadmin
Insta360VRutils
Commits
5274cf6a
Commit
5274cf6a
authored
Feb 22, 2022
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First release
parent
4c0c5b59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
190 additions
and
0 deletions
+190
-0
Insta360_EVO_to_VR
Insta360_EVO_to_VR
+173
-0
Insta360_EVO_to_VR_processdir
Insta360_EVO_to_VR_processdir
+17
-0
No files found.
Insta360_EVO_to_VR
0 → 100755
View file @
5274cf6a
#!/bin/bash
btime_
=
`
grep
btime /proc/stat |
awk
'{print $2}'
`
utime_
=
`
awk
'{print $1}'
/proc/uptime
`
btime_utime_
=
`
echo
"
${
btime_
?
}
+
${
utime_
?
}
"
| bc
-l
`
if
[
x
"
$3
"
==
x
""
]
;
then
echo
"
$0
<command> <left_video> <right_video> <output_file>"
echo
"
$0
<command> <doublefisheye_video> <output_file>"
exit
1
fi
HLS
=
"n"
MP4
=
"n"
EQ
=
"n"
case
"
${
1
}
"
in
hls
)
HLS
=
"y"
echo
"hls mode"
;;
mp4
)
MP4
=
"y"
echo
"mp4 mode"
;;
all
)
HLS
=
"y"
MP4
=
"y"
echo
"Allsizes mode"
;;
equi
)
echo
"Fisheye to Equirectangolar mode"
EQ
=
"y"
;;
equimp4
)
echo
"Fisheye to Equirectangular mp4 mode"
EQ
=
"y"
MP4
=
"y"
;;
equihls
)
echo
"Fisheye to Equirectangular HLS mode"
EQ
=
"y"
HLS
=
"y"
;;
equiall
)
echo
"Fisheye to Equirectangular all size mode"
EQ
=
"y"
MP4
=
"y"
HLS
=
"y"
;;
*
)
echo
"Error. Command has to be hls, mp4, all, equi, equihls, equimp4 or equiall"
echo
$1
exit
1
esac
scales
=
"5760x2880 5120x2560 4096x2048 3840x1920 2880x1440"
degree
=
"180"
yaw
=
"-90"
#VENC="libx264" # can be libx264 or h264_nvenc ( nvidia only after https://github.com/davidramiro/ffmpeg-nvenc-debian )
VENC
=
"h264_nvenc"
HWACC
=
"-hwaccel cuda -hwaccel_output_format cuda"
#HWACC=""
YES
=
"-y"
PRESET
=
"slower"
if
[
"
$VENC
"
==
"h264_nvenc"
]
;
then
PRESET
=
"slow"
fi
if
[
x
"
$4
"
!=
x
""
]
;
then
left
=
$2
right
=
$3
inf
=
$2
.mp4
outf
=
$4
ViENC
=
"libx264"
ffmpeg
$YES
-copyts
\
-i
$left
\
-i
$right
\
-filter_complex
"pad=in_w*2:in_h, overlay=main_w/2:0"
-vcodec
$ViENC
-crf
18
\
-x264-params
mvrange
=
511
-maxrate
80M
-bufsize
25M
-ac
2
\
-pix_fmt
yuv420p
-c
:a aac
-b
:a 160k
-movflags
faststart
\
-preset
$PRESET
$inf
else
inf
=
$2
outf
=
$3
fi
if
[
x
"
$EQ
"
==
x
"y"
]
;
then
ffmpeg
$YES
-i
$inf
-vf
v360
=
dfisheye:equirect:ih_fov
=
$degree
:iv_fov
=
$degree
:yaw
=
${
yaw
}
-vcodec
libx264
\
-crf
18
-x264-params
mvrange
=
511
-maxrate
80M
-bufsize
25M
-ac
2
\
-pix_fmt
yuv420p
-c
:a aac
-b
:a 160k
-movflags
faststart
\
-preset
$PRESET
FullScale_
${
outf
}
spatialmedia
-i
-s
left-right
-m
equirectangular FullScale_
${
outf
}
FullScale_injected_
${
outf
}
inf
=
FullScale_
${
outf
}
fi
num
=
0
scalestring
=
""
vmaps
=
""
amaps
=
""
tees
=
""
for
ftype
in
mp4 hls
do
case
$ftype
in
mp4
)
if
[
$MP4
!=
"y"
]
;
then
continue
fi
;;
hls
)
if
[
$HLS
!=
"y"
]
;
then
continue
fi
esac
for
scale
in
$scales
do
let
"num++"
if
[
x
"
$scale
"
==
"5760x2880"
]
;
then
sc
=
""
else
sc
=
",scale=
$scale
"
fi
size
=
${
scale
/x/
:
}
width
=
`
echo
$scale
|
awk
-F
'x'
'{print $1}'
`
ViENC
=
"
$VENC
"
if
[
"
$width
"
-gt
"4097"
]
;
then
ViENC
=
"libx264"
fi
splits
=
"
$splits
[v
$num
]"
if
[
x
"
$scalestring
"
!=
x
""
]
;
then
scalestring
=
"
$scalestring
;"
fi
scalestring
=
"
$scalestring
[v
${
num
}
]scale=
$size
[v
${
num
}
out]"
vmaps
=
"
$vmaps
-map [v
${
num
}
out] -c:v:
$((
num-1
))
$ViENC
"
if
[
"
$ViENC
"
==
"libx264"
]
;
then
vmaps
=
"
$vmaps
-crf 18 -x264-params mvrange=511"
elif
[
"
$ViENC
"
==
"h264_nvenc"
]
;
then
vmaps
=
"
$vmaps
-preset:v p7 -tune:v:
$((
num-1
))
hq -rc:v:
$((
num-1
))
vbr -cq:v:
$((
num-1
))
19 -profile:v high"
fi
vmaps
=
"
$vmaps
-b:v:
$((
num-1
))
0 -maxrate 80M -bufsize 25M -pix_fmt yuv420p"
vmaps
=
"
$vmaps
-preset
$PRESET
"
amaps
=
"
$amaps
-map a:0 -c:a:
$((
num-1
))
aac -b:a:
$((
num-1
))
160k -ac 2 "
if
[
x
"
$tees
"
!=
x
""
]
;
then
tees
=
"
$tees
|"
fi
tees
=
"
$tees
[select=
\'
v:
$((
num-1
))
,a:
$((
num-1
))
\'
:f=mp4:movflags=+faststart]
${
scale
}
_
${
outf
}
"
#ffmpeg $YES -i $inf -vf v360=dfisheye:equirect:ih_fov=$degree:iv_fov=$degree:yaw=${yaw}${sc} -vcodec $ViENC \
# -crf 18 -x264-params mvrange=511 -maxrate 80M -bufsize 25M -ac 2 \
# -pix_fmt yuv420p -c:a aac -b:a 160k -movflags faststart \
# -preset $PRESET ${scale}_${outf}
#spatialmedia -i -s left-right -m equirectangular ${scale}_${outf} ${scale}_injected_${outf}
done
done
if
[
X
"
$scalestring
"
!=
X
""
]
;
then
ffmpeg
$YES
-i
$inf
-filter_complex
"[0:v]split=
${
num
}${
splits
}
;
$scalestring
"
$vmaps
$amaps
-f
tee
"
$tees
"
fi
# scale=3840x2560
# Oculus: 1920*1832 per eye.
# 1920*2 = 3840 like 4k.
Insta360_EVO_to_VR_processdir
0 → 100755
View file @
5274cf6a
#!/bin/bash
if
[
x
"
$1
"
==
x
""
]
;
then
com
=
"equi"
else
com
=
"
$1
"
fi
cd
`
pwd
`
for
vl
in
VID_
*
_00_
*
.insv
do
vout
=
`
echo
$vl
|
sed
-e
"s/
\.
insv/
\_
VR
\_
180
\_
LR
\.
mp4/"
`
echo
"--------------------------------------"
echo
"creating:
$vout
"
echo
"LEFT:
$vl
"
vr
=
`
echo
$vl
|
sed
-e
's/\_00\_/\_10\_/'
`
echo
"RIGHT:
$vr
"
Insta360_EVO_to_VR
$com
$vl
$vr
$vout
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment