hls-test/make-hls-segment.sh

31 lines
1.2 KiB
Bash
Raw Normal View History

MOVFLAGS="+frag_keyframe+empty_moov+default_base_moof+faststart"
SEGFLAGS="-f ssegment -segment_time 10 -segment_format movflags=$MOVFLAGS"
BITRATE="-b:v 1000k"
VIDEO_VP9="-vcodec libvpx-vp9 -row-mt 1 -cpu-used 3 -g 240 $BITRATE -s 854x480"
VIDEO_H264="-vcodec h264 -g 240 $BITRATE $SIZE_MAIN -s 640x360"
VIDEO_JPEG="-vcodec mjpeg -g 240 $BITRATE $SIZE_JPEG -s 213x120"
AUDIO_OPUS="-acodec libopus -ac 2 -ar 48000 -vb 96k"
AUDIO_AAC="-ac 2 -ar 44100 -vb 128k"
AUDIO_MP3="-acodec libmp3lame -ac 2 -ar 44100 -vb 128k"
INFILE=caminandes-llamigos.webm
set -e
# Audio for HLS
ffmpeg -i $INFILE -vn $AUDIO_AAC $SEGFLAGS -segment_list segment-aac.m3u8 -y segment-aac-%04d.mp4
php timestamp-id3.php segment-aac.m3u8 segment-aac.mp4
ffmpeg -i $INFILE -vn $AUDIO_OPUS $SEGFLAGS -segment_list segment-opus.m3u8 -y segment-opus-%04d.mp4
php timestamp-id3.php segment-opus.m3u8 segment-opus.mp4
ffmpeg -i $INFILE -vn $AUDIO_MP3 -segment_list segment-mp3.m3u8 -y segment-mp3-%04d.mp3
php timestamp-id3.php segment-mp3.m3u8 segment-mp3.mp3
# Video for HLS
ffmpeg -i $INFILE -an $VIDEO_VP9 $SEGFLAGS -segment_list segment-vp9.m3u8 -y segment-vp9-%04d.mp4
php timestamp-id3.php segment-vp9.m3u8 segment-vp9.mp4