hls-test/make-hls-new.sh

44 lines
1.8 KiB
Bash
Raw Normal View History

2023-02-13 22:05:37 +00:00
MOVFLAGS="-movflags +frag_keyframe+empty_moov+default_base_moof+faststart"
HLSFLAGS="-hls_time 10 -hls_list_size 0 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod"
2023-02-16 16:15:33 +00:00
TSFLAGS="-hls_time 10 -hls_list_size 0 -hls_segment_type mpegts -hls_flags single_file -hls_playlist_type vod"
BITRATE_HI="-b:v 1250k"
BITRATE_LO="-b:v 1000k"
2023-02-13 22:05:37 +00:00
2023-02-16 16:15:33 +00:00
SIZE_MAIN="-s 854x480"
SIZE_JPEG="-s 213x120"
VIDEO_H264="-vcodec h264 -g 240 $BITRATE_HI $SIZE_MAIN"
VIDEO_JPEG="-vcodec mjpeg -g 240 $BITRATE_LO $SIZE_JPEG"
VIDEO_VP8="-vcodec libvpx -cpu-used 3 -g 240 $BITRATE_HI $SIZE_MAIN"
VIDEO_VP9="-vcodec libvpx-vp9 -row-mt 1 -cpu-used 3 -g 240 $BITRATE_LO $SIZE_MAIN"
2023-02-13 22:05:37 +00:00
AUDIO_VORBIS="-acodec libvorbis -ac 2 -ar 44100 -vb 128k"
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"
2023-02-16 16:15:33 +00:00
#INFILE=polyphon.ogv
INFILE=caminandes-llamigos.webm
set -e
2023-02-13 22:05:37 +00:00
# Flat WebM
2023-02-16 16:15:33 +00:00
ffmpeg -i $INFILE $VIDEO_VP8 $AUDIO_VORBIS -y new-vp8.webm
ffmpeg -i $INFILE $VIDEO_VP9 $AUDIO_OPUS -y new-vp9.webm
2023-02-13 22:05:37 +00:00
# Flat Quicktime
2023-02-16 16:15:33 +00:00
ffmpeg -i $INFILE -s 320x180 $VIDEO_JPEG $AUDIO_MP3 $MOVFLAGS -y new-mjpeg.mov
2023-02-13 22:05:37 +00:00
# Audio for HLS
2023-02-16 16:15:33 +00:00
ffmpeg -i $INFILE -vn $AUDIO_AAC $HLSFLAGS -hls_segment_filename new-aac.mp4 -y new-aac.m3u8
ffmpeg -i $INFILE -vn $AUDIO_OPUS $HLSFLAGS -hls_segment_filename new-opus.mp4 -y new-opus.m3u8
#ffmpeg -i $INFILE -vn $AUDIO_MP3 $HLSFLAGS -hls_segment_filename new-mp3.mp4 -y new-mp3-mp4.m3u8
#ffmpeg -i $INFILE -vn $AUDIO_MP3 $TSFLAGS -hls_segment_filename new-mp3.ts -y new-mp3-ts.m3u8
2023-02-16 19:40:59 +00:00
ffmpeg -i $INFILE -vn $AUDIO_MP3 -f segment -segment_time 10 -segment_list new-mp3.m3u8 -y new-mp3-%04d.mp3
php timestamp-id3.php new-mp3.m3u8 new-mp3.mp3
2023-02-13 22:05:37 +00:00
# Video for HLS
2023-02-16 16:15:33 +00:00
ffmpeg -i $INFILE -an $VIDEO_VP9 $HLSFLAGS -hls_segment_filename new-vp9.mp4 -y new-vp9.m3u8