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
b3f2b628
Commit
b3f2b628
authored
Feb 22, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various fixes, basic functionality working now
parent
5274cf6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
17 deletions
+55
-17
Insta360_EVO_to_VR
Insta360_EVO_to_VR
+55
-17
No files found.
Insta360_EVO_to_VR
View file @
b3f2b628
#!/bin/bash
#!/bin/bash
btime_
=
`
grep
btime /proc/stat |
awk
'{print $2}'
`
utime_
=
`
awk
'{print $1}'
/proc/uptime
`
btime_utime_
=
`
echo
"
${
btime_
?
}
+
${
utime_
?
}
"
| bc
-l
`
...
...
@@ -12,6 +12,20 @@ fi
HLS
=
"n"
MP4
=
"n"
EQ
=
"n"
HLSDIR
=
"HLS"
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"
MAXGPUS
=
3
PRESET
=
"slower"
case
"
${
1
}
"
in
hls
)
HLS
=
"y"
...
...
@@ -55,16 +69,6 @@ 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
...
...
@@ -104,6 +108,9 @@ scalestring=""
vmaps
=
""
amaps
=
""
tees
=
""
hlsselect
=
""
streammap
=
""
gpus
=
0
for
ftype
in
mp4 hls
do
case
$ftype
in
...
...
@@ -115,6 +122,9 @@ do
hls
)
if
[
$HLS
!=
"y"
]
;
then
continue
else
mkdir
-p
${
HLSDIR
}
mkdir
-p
${
HLSDIR
}
/
${
outf
}
fi
esac
for
scale
in
$scales
...
...
@@ -131,6 +141,14 @@ do
if
[
"
$width
"
-gt
"4097"
]
;
then
ViENC
=
"libx264"
fi
if
[
x
"
$ViENC
"
==
x
"h264_nvenc"
]
;
then
if
[
"
$gpus
"
-gt
"
$((
MAXGPUS-1
))
"
]
;
then
ViENC
=
"libx264"
echo
"MAX GPU REACHED"
fi
let
"gpus++"
fi
splits
=
"
$splits
[v
$num
]"
if
[
x
"
$scalestring
"
!=
x
""
]
;
then
...
...
@@ -141,16 +159,26 @@ do
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"
vmaps
=
"
$vmaps
-preset:v:
$((
num-1
))
p7 -tune:v:
$((
num-1
))
hq -rc:v:
$((
num-1
))
vbr -cq:v:
$((
num-1
))
19"
vmaps
=
"
$vmaps
-profile:v:
$((
num-1
))
high"
fi
vmaps
=
"
$vmaps
-b:v:
$((
num-1
))
0 -maxrate 80M -bufsize 25M -pix_fmt yuv420p"
vmaps
=
"
$vmaps
-preset
$PRESET
"
vmaps
=
"
$vmaps
-preset
:v:
$((
num-1
))
$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
|"
if
[
"
$ftype
"
==
"mp4"
]
;
then
if
[
x
"
$tees
"
!=
x
""
]
;
then
tees
=
"
$tees
|"
fi
tees
=
"
$tees
[select=
\'
v:
$((
num-1
))
,a:
$((
num-1
))
\'
:f=mp4:movflags=+faststart]
${
scale
}
_
${
outf
}
"
elif
[
"
$ftype
"
==
"hls"
]
;
then
if
[
x
"
$hlsselect
"
!=
x
""
]
;
then
hlsselect
=
"
$hlsselect
,"
fi
vmaps
=
"
$vmaps
-flags +global_header"
hlsselect
=
"
${
hlsselect
}
v:
$((
num-1
))
,a:
$((
num-1
))
"
streammap
=
"
${
streammap
}
v:
$((
num-1
))
,a:
$((
num-1
))
"
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 \
...
...
@@ -162,7 +190,17 @@ do
done
if
[
X
"
$scalestring
"
!=
X
""
]
;
then
ffmpeg
$YES
-i
$inf
-filter_complex
"[0:v]split=
${
num
}${
splits
}
;
$scalestring
"
$vmaps
$amaps
-f
tee
"
$tees
"
if
[
x
"
$HLS
"
==
"y"
]
;
then
if
[
x
"
$tees
"
!=
x
""
]
;
then
tees
=
"
$tees
|"
fi
tees
=
"
$tees
[select=
\'
$hlsselect
\'
:f=hls:var_stream_map=
\'
$streammap
\'
:master_pl_name=playlist.m3u8"
tees
=
"
${
tees
}
:hls_time=6:hls_list_size=0:hls_segment_type=fmp4:hls_playlist_type=vod"
tees
=
"
${
tees
}
:hls_flags=independent_segments:hls_segment_filename=
${
HLSDIR
}
/
${
outf
}
/stream_%v/data%03d.m4s]"
tees
=
"
${
tees
}${
HLSDIR
}
/
${
outf
}
/stream_%v.m3u8"
fi
ffmpeg
$YES
-i
$inf
-filter_complex
"[0:v]split=
${
num
}${
splits
}
;
$scalestring
"
$vmaps
$amaps
-f
tee
"
$tees
"
fi
...
...
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