Skip to content

Commit

Permalink
Merge branch 'feature/ffmpeg-script' into develop
Browse files Browse the repository at this point in the history
* feature/ffmpeg-script:
  Added thumbnail script
  Added duration script
  Added hls script
  • Loading branch information
Simba830 committed Jul 3, 2020
2 parents c4ef464 + 0f32442 commit af2bd40
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/encoding/duration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Duration
ffmpeg -i $1.mp4 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//
10 changes: 10 additions & 0 deletions app/encoding/hls_h264.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "encoding start " $1
mkdir $1
ffmpeg -hide_banner -y -i $1.mp4 \
-vf scale=w=640:h=360:force_original_aspect_ratio=decrease -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 800k -maxrate 856k -bufsize 1200k -b:a 96k -hls_segment_filename $1/360p_%03d.ts $1/360p.m3u8 \
-vf scale=w=842:h=480:force_original_aspect_ratio=decrease -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 1400k -maxrate 1498k -bufsize 2100k -b:a 128k -hls_segment_filename $1/480p_%03d.ts $1/480p.m3u8 \
-vf scale=w=1280:h=720:force_original_aspect_ratio=decrease -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 2800k -maxrate 2996k -bufsize 4200k -b:a 128k -hls_segment_filename $1/720p_%03d.ts $1/720p.m3u8 \
-vf scale=w=1920:h=1080:force_original_aspect_ratio=decrease -c:a aac -ar 48000 -c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 5000k -maxrate 5350k -bufsize 7500k -b:a 192k -hls_segment_filename $1/1080p_%03d.ts $1/1080p.m3u8
echo "encoding done" $1
6 changes: 6 additions & 0 deletions app/encoding/thumbnail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# thumbnail
#encoding -i $1.mp4 -s 400x222 -ss 00:00:14.435 -vframes 1 out.png
ffmepg -i $1.mp4 -r 0.5 -f image2 output_%05d.jpg

0 comments on commit af2bd40

Please sign in to comment.