Skip to content

Commit a3d3941

Browse files
author
Alex Conner
committed
Initial Import
1 parent 88edf85 commit a3d3941

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

template.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<title>Video Player</title>
4+
</head>
5+
<body style="background-color: black;">
6+
<script src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
7+
<script src="https://cdn.jsdelivr.net/mediaelement/latest/mediaelement-and-player.min.js"></script>
8+
<link href="https://cdn.jsdelivr.net/mediaelement/latest/mediaelementplayer.min.css" rel="stylesheet">
9+
<div style="margin: auto; position: absolute; top: 0; bottom: 0; left: 0; right: 0; height: 480px; width: 720px;">
10+
<video id="video" class="mejs__player" src="master.m3u8" width="720" height="480" poster="poster.png"></video>
11+
</div>
12+
</body>
13+
</html>

template.m3u8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#EXTM3U
2+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1228800,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=320x240
3+
320p/320p.m3u8
4+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1228800,CODECS="avc1.4d0028,mp4a.40.2",RESOLUTION=854x480
5+
480p/480p.m3u8
6+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3072000,CODECS="avc1.640029,mp4a.40.2",RESOLUTION=1280x720
7+
720p/720p.m3u8
8+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4096000,CODECS="avc1.640029,mp4a.40.2",RESOLUTION=1920x1080
9+
1080p/1080p.m3u8

transcode.bat

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
for /f %%f in ('dir /b input') do (
2+
echo %%f
3+
mkdir %%~nf\1080p\
4+
mkdir %%~nf\720p\
5+
mkdir %%~nf\480p\
6+
mkdir %%~nf\320p\
7+
copy template.m3u8 %%~nf\master.m3u8
8+
copy template.html %%~nf\index.html
9+
ffmpeg.exe -i input\%%f -pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 20 -ab 128k -maxrate 3600k -profile:v high -level 4.1 -vf scale=1920:-2 -f hls -hls_playlist_type vod %%~nf\1080p\1080p.m3u8 -pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 22 -ab 96k -maxrate 2400k -profile:v high -level 4.1 -vf scale=1280:-2 -f hls -hls_playlist_type vod %%~nf\720p\720p.m3u8 -pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 24 -ab 64k -maxrate 1200k -profile:v main -level 4.0 -vf scale=512:-2 -f hls -hls_playlist_type vod %%~nf\480p\480p.m3u8 -pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 26 -ab 32k -maxrate 600k -profile:v baseline -level 3.0 -vf scale=384:-2 -f hls -hls_playlist_type vod %%~nf\320p\320p.m3u8
10+
)
11+

transcode.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
for f in $("ls input/"); do
2+
echo "$f"
3+
base=$(basename "$f")
4+
mkdir -p "$base/1080p"
5+
mkdir -p "$base/720p"
6+
mkdir -p "$base/480p"
7+
mkdir -p "$base/320p"
8+
cp template.m3u8 "$base/master.m3u8"
9+
cp template.html "$base/index.html"
10+
ffmpeg -i "input/$f"\
11+
-pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 20 -ab 128k -maxrate 3600k -profile:v high -level 4.1 -vf scale=1920:-2 -f hls -hls_playlist_type vod "$base/1080p/1080p.m3u8"\
12+
-pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 22 -ab 96k -maxrate 2400k -profile:v high -level 4.1 -vf scale=1280:-2 -f hls -hls_playlist_type vod "$base/720p/720p.m3u8"\
13+
-pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 24 -ab 64k -maxrate 1200k -profile:v main -level 4.0 -vf scale=512:-2 -f hls -hls_playlist_type vod "$base/480p/480p.m3u8"\
14+
-pix_fmt yuv420p -c:a aac -c:v libx264 -x264opts keyint=120:min-keyint=120 -hls_time 4 -preset veryslow -bufsize 4000k -crf 26 -ab 32k -maxrate 600k -profile:v baseline -level 3.0 -vf scale=384:-2 -f hls -hls_playlist_type vod "$base/320p/320p.m3u8"
15+
done

0 commit comments

Comments
 (0)