hls-test/make-fmp4.sh

37 lines
1.4 KiB
Bash
Executable file

interval=10
MOVFLAGS="-movflags +frag_keyframe+empty_moov -force_key_frames expr:gte(t,n_forced*$interval)"
AUDFLAGS="-movflags +empty_moov -frag_duration ${interval}000000"
BITRATE_HI="-b:v 1250k"
BITRATE_LO="-b:v 1000k"
SIZE_MAIN="-s 854x480"
VIDEO_H264="-vcodec h264 -g 240 $BITRATE_HI $SIZE_MAIN"
VIDEO_VP9="-vcodec libvpx-vp9 -tile-columns 2 -row-mt 1 -cpu-used 3 -g 240 $BITRATE_LO $SIZE_MAIN"
AUDIO_OPUS="-acodec libopus -ac 2 -ar 48000 -ab 96k"
AUDIO_AAC="-ac 2 -ar 44100 -ab 128k"
AUDIO_MP3="-acodec libmp3lame -ac 2 -ar 44100 -ab 128k"
INFILE=caminandes-llamigos.webm
set -e
# Audio for HLS
ffmpeg -i $INFILE -vn $AUDIO_MP3 -y fmp4.audio.mp3
ffmpeg -i $INFILE -vn $AUDIO_AAC $AUDFLAGS -y fmp4.audio.aac.mp4
ffmpeg -i $INFILE -vn $AUDIO_OPUS $AUDFLAGS -y fmp4.audio.opus.mp4
# Video for HLS
ffmpeg -i $INFILE -an $VIDEO_H264 $MOVFLAGS -pass 1 -y fmp4.video.h264.mp4
ffmpeg -i $INFILE -an $VIDEO_H264 $MOVFLAGS -pass 2 -y fmp4.video.h264.mp4
ffmpeg -i $INFILE -an $VIDEO_VP9 $MOVFLAGS -pass 1 -y fmp4.video.vp9.mp4
ffmpeg -i $INFILE -an $VIDEO_VP9 $MOVFLAGS -pass 2 -y fmp4.video.vp9.mp4
# Playlist processing
#php extract-playlist.php fmp4.audio.mp3 fmp4.audio.mp3.m3u8
#php extract-playlist.php fmp4.audio.aac.mp4 fmp4.audio.aac.mp4.m3u8
#php extract-playlist.php fmp4.audio.opus.mp4 fmp4.audio.opus.mp4.m3u8
#php extract-playlist.php fmp4.video.h264.mp4 fmp4.video.h264.mp4.m3u8
#php extract-playlist.php fmp4.video.vp9.mp4 fmp4.video.vp9.mp4.m3u8