Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Multimap, and data files. Finally got rid of vignetting, and a …
…handy speed boost
- Loading branch information
1 parent
8c92e01
commit 51a70b4
Showing
12 changed files
with
97 additions
and
710 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
#This will split, defish, blend and re-assemble Samsung Gear 360 video | ||
|
||
#trap Ctrl-C | ||
set -e | ||
trap 'printf "Received SIGINT: Terminating.\n"; rm -f $base"_Remap_360.mp4" ; exit 130' INT | ||
|
||
Success_Remap(){ | ||
#Collect data | ||
echo "Successful ffmpeg run." | ||
#Copy attributes | ||
chmod --reference="$1" "$2" | ||
chown --reference="$1" "$2" | ||
touch --reference="$1" "$2" | ||
} | ||
|
||
|
||
#dealing with filenames and extentions | ||
fullpath="$1" | ||
filename="${fullpath##*/}" # Strip longest match of */ from start | ||
dir="${fullpath:0:${#fullpath} - ${#filename}}" # Substring from 0 thru pos of filename | ||
base="${filename%.[^.]*}" # Strip shortest match of . plus at least one non-dot char from end | ||
ext="${filename:${#base} + 1}" # Substring from len of base thru end | ||
if [[ -z "$base" && -n "$ext" ]]; then # If we have an extension and no base, it's really the base | ||
base=".$ext" | ||
ext="" | ||
fi | ||
|
||
#set where the maps are kept | ||
map_dir="/data/Projects/RemapFilter/" | ||
#set where the remaps go | ||
remap_dir="Remap" | ||
mkdir -p "$remap_dir" | ||
#Ffmpeg's wonderful remap filter | ||
if ffmpeg -y -i "$1" \ | ||
-i "$map_dir"/l0000_x.tif -i "$map_dir"/l0000_y.tif \ | ||
-loop 1 -i "$map_dir"/Alpha_Map.tif \ | ||
-i "$map_dir"/r0000_x.tif -i "$map_dir"/r0000_y.tif \ | ||
-i "$map_dir"/l0000.tif -i "$map_dir"/r0000.tif \ | ||
-metadata:s:v spherical-video='<rdf:SphericalVideo xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/"> <GSpherical:Spherical>true</GSpherical:Spherical> <GSpherical:Stitched>true</GSpherical:Stitched> <GSpherical:ProjectionType>equirectangular</GSpherical:ProjectionType> </rdf:SphericalVideo>' \ | ||
-c:v hevc_nvenc -rc constqp -qp 21 -cq 21 \ | ||
-filter_complex \ | ||
"[3]alphaextract[alf]; \ | ||
[v:0]split=2[l][r]; \ | ||
[l][1][2]remap[l_remap]; \ | ||
[r][4][5]remap[r_remap]; \ | ||
[l_remap]setsar=sar=1/1[l_sar]; \ | ||
[r_remap]setsar=sar=1/1[r_sar]; \ | ||
[l_sar][6]blend=c0_mode=multiply[l_blend]; \ | ||
[r_sar][7]blend=c0_mode=multiply[r_blend]; \ | ||
[r_blend][alf]alphamerge[r_rm_a]; \ | ||
[l_blend][r_rm_a]overlay=0:0[merged]; \ | ||
[merged]eq=contrast=1.4:brightness=0.2:gamma=1.2:saturation=0.9[out]" \ | ||
-map [out] -map 0:a? "$remap_dir"/"$base""_Remap_360.mkv" < /dev/null ; | ||
then | ||
Success_Remap "$1" "$remap_dir"/"$base""_Remap_360.mkv" | ||
else | ||
rm -f "$remap_dir"/"$base""_Remap_360.mkv" | ||
fi | ||
#-hwaccel cuvid -c:v hevc_cuvid | ||
#[r_blend][alf]alphamerge[r_rm_a]; \ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.