-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-mongodb
- Loading branch information
Showing
8 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
file=$1 | ||
server=$2 | ||
noofclients=$3 | ||
|
||
for (( i=1; i <= $noofclients; ++i )) | ||
do | ||
COMMAND="ffmpeg -re -stream_loop -1 -i ${file} -codec copy -f flv ${server}_${i}" | ||
$COMMAND >/dev/null 2>&1 & | ||
echo "running command $COMMAND" | ||
sleep 1 | ||
done |
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,12 @@ | ||
#!/bin/bash | ||
file=$1 | ||
server=$2 | ||
noofclients=$3 | ||
|
||
for (( i=1; i <= $noofclients; ++i )) | ||
do | ||
COMMAND="ffmpeg -re -stream_loop -1 -i ${file} -codec copy -f mpegts ${server}_${i}" | ||
$COMMAND >/dev/null 2>&1 & | ||
echo "running command $COMMAND" | ||
sleep 1 | ||
done |
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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# This bash script converts your VoD files to HLS format. (720p,480p,240p) | ||
# This bash script converts your VoD files to HLS format. (720p, 480p, 240p) | ||
# | ||
# Installation Instructions | ||
# sudo apt-get update && sudo apt-get install ffmpeg -y | ||
# vim [AMS-DIR]/webapps/applications(LiveApp or etc.)/WEB-INF/red5-web.properties | ||
# settings.vodUploadFinishScript=/Script-DIR/vod_transcode.sh | ||
# switch to application advance properties and set the property, | ||
# "vodUploadFinishScript": "/path/to/vod_transcode.sh ", | ||
# sudo service antmedia restart | ||
# | ||
|
||
# Don't forget to change the Ant Media Server App Name | ||
# Don't forget to change the Ant Media Server App Name in which you want to save the files | ||
AMS_APP_NAME="WebRTCAppEE" | ||
|
||
file=$1 | ||
file_name=$(basename $file .mp4) | ||
|
||
# Bitrates | ||
# 720p | ||
a=("1280x720" "2500k") | ||
# 480p | ||
b=("640x480" "1500k") | ||
# 240p | ||
c=("320x240" "800k") | ||
|
||
# Bitrates and resolutions | ||
resolutions=("1280x720" "640x480" "320x240") | ||
bitrates=("2500k" "1500k" "800k") | ||
names=("720p" "480p" "240p") | ||
|
||
cd /usr/local/antmedia/webapps/$AMS_APP_NAME/streams/ | ||
|
||
$(command -v ffmpeg) -i $file -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -s:v:0 ${a[0]} -c:v:0 libx264 -b:v:0 ${a[1]} -s:v:1 ${b[0]} -c:v:1 libx264 -b:v:1 ${b[1]} -s:v:2 ${c[0]} -c:v:2 libx264 -b:v:2 ${c[1]} -c:a aac -f hls -hls_playlist_type vod -master_pl_name ${file_name}.m3u8 -hls_segment_filename ${file_name}_%v/${file_name}%04d.ts -use_localtime_mkdir 1 -var_stream_map "v:0,a:0,name:720p v:1,a:1,name:480p v:2,a:2,name:360p" ${file_name}_%v.m3u8 | ||
# Create directories for each resolution | ||
for name in "${names[@]}"; do | ||
mkdir -p ${file_name}_${name} | ||
done | ||
|
||
$(command -v ffmpeg) -i $file \ | ||
-map 0:v -map 0:a -s:v:0 ${resolutions[0]} -c:v:0 libx264 -b:v:0 ${bitrates[0]} \ | ||
-map 0:v -map 0:a -s:v:1 ${resolutions[1]} -c:v:1 libx264 -b:v:1 ${bitrates[1]} \ | ||
-map 0:v -map 0:a -s:v:2 ${resolutions[2]} -c:v:2 libx264 -b:v:2 ${bitrates[2]} \ | ||
-c:a aac -f hls -hls_playlist_type vod \ | ||
-master_pl_name ${file_name}.m3u8 \ | ||
-hls_segment_filename ${file_name}_%v/${file_name}%04d.ts \ | ||
-var_stream_map "v:0,a:0,name:720p v:1,a:1,name:480p v:2,a:2,name:240p" \ | ||
${file_name}_%v/${file_name}.m3u8 |