interval=10 #MOVFLAGS="-movflags +frag_keyframe+empty_moov -force_key_frames expr:gte(t,n_forced*$interval)" MOVFLAGS="-movflags +frag_keyframe+empty_moov" AUDFLAGS="-movflags +empty_moov -frag_duration ${interval}000000" BITRATE_HI="-b:v 1250k" BITRATE_LO="-b:v 1000k" SIZE_MAIN="-s 854x480" SIZE_H263="-s 352x288" SIZE_SMALL="-s 256x144" VIDEO_H264="-vcodec h264 -g 240 $BITRATE_HI $SIZE_MAIN" VIDEO_MPEG4="-vcodec mpeg4 -g 240 $BITRATE_HI $SIZE_MAIN" VIDEO_H263="-vcodec h263 -g 240 $BITRATE_LO $SIZE_H263" VIDEO_MJPEG="-vcodec mjpeg $BITRATE_HI $SIZE_SMALL" 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 48000 -ab 128k" AUDIO_MP3="-acodec libmp3lame -ac 2 -ar 48000 -ab 128k" INFILE=caminandes-llamigos.webm set -e # Audio for HLS #ffmpeg -i $INFILE -vn $AUDIO_MP3 -y fmp4.audio.mpeg.mp3 #ffmpeg -i $INFILE -vn $AUDIO_MP3 $AUDFLAGS -y fmp4.audio.mpeg.mp4 #ffmpeg -i $INFILE -vn $AUDIO_MP3 $AUDFLAGS -y fmp4.audio.mpeg.mov #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_VP9 $MOVFLAGS -pass 1 -y fmp4.480p.vp9.mp4 #ffmpeg -i $INFILE -an $VIDEO_VP9 $MOVFLAGS -pass 2 -y fmp4.480p.vp9.mp4 #ffmpeg -i $INFILE -an $VIDEO_H264 $MOVFLAGS -pass 1 -y fmp4.480p.h264.mp4 #ffmpeg -i $INFILE -an $VIDEO_H264 $MOVFLAGS -pass 2 -y fmp4.480p.h264.mp4 #ffmpeg -i $INFILE -an $VIDEO_MPEG4 $MOVFLAGS -pass 1 -y fmp4.480p.mpeg4.mp4 #ffmpeg -i $INFILE -an $VIDEO_MPEG4 $MOVFLAGS -pass 2 -y fmp4.480p.mpeg4.mp4 #ffmpeg -i $INFILE -an $VIDEO_H263 $MOVFLAGS -y fmp4.288p.h263.3gp # Note use duration, not keyframe interval, for fragments, # because all are keyframes! ffmpeg -i $INFILE -an $VIDEO_MJPEG $AUDFLAGS -y fmp4.120p.mjpeg.mp4 ffmpeg -i $INFILE -an $VIDEO_MJPEG $AUDFLAGS -y fmp4.120p.mjpeg.mov # Playlist processing php extract-playlist.php fmp4.audio.mpeg.mp3 > fmp4.audio.mpeg.mp3.m3u8 php extract-playlist.php fmp4.audio.mpeg.mp4 > fmp4.audio.mpeg.mp4.m3u8 php extract-playlist.php fmp4.audio.mpeg.mov > fmp4.audio.mpeg.mov.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.480p.vp9.mp4 > fmp4.480p.vp9.mp4.m3u8 php extract-playlist.php fmp4.480p.h264.mp4 > fmp4.480p.h264.mp4.m3u8 php extract-playlist.php fmp4.480p.mpeg4.mp4 > fmp4.480p.mpeg4.mp4.m3u8 php extract-playlist.php fmp4.288p.h263.3gp > fmp4.288p.h263.3gp.m3u8 php extract-playlist.php fmp4.120p.mjpeg.mp4 > fmp4.120p.mjpeg.mp4.m3u8 php extract-playlist.php fmp4.120p.mjpeg.mov > fmp4.120p.mjpeg.mov.m3u8 MPEG_TRACK=audio.mpeg.mp3 #MPEG_TRACK=audio.mpeg.mov #MPEG_TRACK=audio.mpeg.mp4 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 > fmp4.vp9.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 480p.h264.mp4 > fmp4.h264.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.mpeg4.mp4 > fmp4.mpeg4.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 288p.h263.3gp > fmp4.h263.3gp.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 120p.mjpeg.mp4 > fmp4.mjpeg.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 120p.mjpeg.mov > fmp4.mjpeg.mov.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 120p.mjpeg.mp4 > fmp4.mjpeg.lie.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 120p.mjpeg.mov > fmp4.mjpeg.mov.lie.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 480p.h264.mp4 > fmp4.vp9-h264.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 480p.mpeg4.mp4 > fmp4.vp9-mpeg4.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 288p.h263.3gp > fmp4.vp9-h263.3gp.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 120p.mjpeg.mp4 > fmp4.vp9-mjpeg.m3u8 php meta-playlist.php fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 120p.mjpeg.mp4 > fmp4.vp9-mjpeg.lie.m3u8 php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov.lie.m3u8