Last active
March 12, 2019 19:44
-
-
Save x1wins/27c70c713e4d5418944b0d1b0f4ed10d 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 | |
start=$(date) | |
# source="trailer_1080p.ogg" | |
# target="trailer" | |
source=${1} | |
target=${2} | |
rm -rf ${target} | |
mkdir ${target} | |
function encoding { | |
rm -rf ${target}/${2} | |
mkdir ${target}/${2} | |
mp4="${target}/${2}/${2}.mp4" | |
trans="ffmpeg -y -i ${source} -vf scale=w=${1}:h=${2} -c:v libx265 -crf 28 -c:a aac -b:a 128k -tag:v hvc1 ${mp4}" | |
${trans} | |
hls="ffmpeg -i ${mp4} -c:v copy -c:a copy -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -hls_segment_type fmp4 -hls_segment_filename ${target}/${2}/${2}-%08d.m4s ${target}/${2}/${2}.m3u8" | |
${hls} | |
rm ${mp4} | |
} | |
encoding 640 360 | |
encoding 1280 720 | |
encoding 1920 1080 | |
cp playlist_h265.m3u8 ${target}/playlist_h265.m3u8 | |
echo -e "Encoding Start \n$start" | |
echo "Encoding Complete" | |
date | |
# example | |
# bash encoding_h265.sh iamlegend.ts iamlegend | |
# bash encoding_h265.sh trailer_1080p.ogg trailer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you want sample movie
I will recommend big buck bunny
download https://peach.blender.org/trailer-page/
create playlist
download https://gist.github.com/x1wins/9c36baadfc9985092a23d73a6a6f1e1a
copy to trailer/playlist_h265.m3u8
you can connect below url
https://localhost/trailer/360/360.m3u8
https://localhost/trailer/720/720.m3u8
https://localhost/trailer/1080/1080.m3u8
https://localhost/trailer/playlist_h265.m3u8
http server
# https://www.npmjs.com/package/http-server $ npm install http-server -g $ http-server ./ -p 80