Created
September 3, 2017 21:10
-
-
Save ultramango/8365652860090f67c6c857c0a2d79704 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# To be used with ./gear360redir.sh | |
# A lot of static variables, change to your need | |
# Test video filename | |
TESTVIDEO="$1" | |
OUTVIDEO="output_one.mp4" | |
# Test video duration in seconds | |
TESTDURATION=5 | |
TESTVIDEOSIZEW=3840 | |
TESTVIDEOSIZEH=1920 | |
BYTESPERPIXEL=3 | |
TESTVIDEOSIZE="${TESTVIDEOSIZEW}x${TESTVIDEOSIZEH}" | |
FFMPEGLOGLEVEL="-loglevel quiet" | |
create_test_video() { | |
echo "Creating test video ${TESTVIDEO}" | |
ffmpeg ${FFMPEGLOGLEVEL} -y -f lavfi -i testsrc=duration=${TESTDURATION}:size=${TESTVIDEOSIZE}:rate=30 -f mp4 ${TESTVIDEO} | |
} | |
all_in_one() { | |
# pv tool could be used to monitor progress | |
let READSIZE=${TESTVIDEOSIZEH}*${TESTVIDEOSIZEW}*${BYTESPERPIXEL} | |
echo "Trying in one go..." | |
ffmpeg ${FFMPEGLOGLEVEL} -y -i ${TESTVIDEO} -pix_fmt rgb24 -f rawvideo - | \ | |
split -b ${READSIZE} --filter="convert -size ${TESTVIDEOSIZE} -depth 8 rgb:- jpg:- | ./gear360redir.sh" | \ | |
ffmpeg ${FFMPEGLOGLEVEL} -y -f image2pipe -r 30 -vcodec mjpeg -i - -c:v libx265 -x265-params crf=18 ${OUTVIDEO} | |
} | |
all_in_one | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment