This commit is contained in:
Brooke Vibber 2023-04-14 17:18:22 -07:00
parent 1937687d03
commit 64b3f0e690
3 changed files with 94 additions and 0 deletions

77
fmp4-vp8.html Normal file
View file

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>HLS VP9/fMP4 test</title>
<link rel=stylesheet type=text/css href=video-js/video-js.css>
</head>
<body>
<h1>HLS VP9/fMP4 test</h1>
<h2>Caminandes - Llamigos</h2>
<ul>
<li><a href="fmp4-codecs.html">see codec variants</a></li>
<li><a href="fmp4-tracks.html">see component track list</a></li>
</ul>
<h3>Native HLS</h3>
<p>HLS with VP9 in mp4, JPEG in mp4, and Opus and AAC in mp4</p>
<div>
<video controls width=640 height=360>
<source type=application/vnd.apple.mpegurl src=fmp4.vp9-mjpeg.m3u8>
</video>
</div>
<h3>Overridden HLS</h3>
<p>HLS with VP8 in mp4, JPEG in mp4, and Opus and AAC in mp4</p>
<div>
<video class=override controls width=640 height=360>
<source type=application/vnd.apple.mpegurl src=fmp4.vp9-mjpeg.m3u8>
</video>
</div>
<script src="video.js/dist/alt/video.core.js"></script>
<script src="http-streaming/dist/videojs-http-streaming.js"></script>
<script type="text/javascript">
videojs.log.level('debug');
console.log(typeof MediaSource)
if (typeof MediaSource !== 'undefined') {
//let vp9 = MediaSource.isTypeSupported('video/mp4; codecs="vp09.00.41.08"');
//let opus = MediaSource.isTypeSupported('video/mp4; codecs="opus"');
//let mp3 = MediaSource.isTypeSupported('audio/mpeg');
//if (vp9 && (opus || mp3)) {
for (let video of document.querySelectorAll('video')) {
let playerConfig = {
responsive: true,
controlBar: {
volumePanel: {
vertical: true,
inline: false
}
},
html5: {
vhs: {
// Currently the MP3 audio track fails in Safari
// and it doesn't grok the Opus
// Either fix MP3 handling in vhs or use AAC.
overrideNative: video.classList.contains('override')
}
},
};
video.classList.add('video-js');
video.classList.add('vjs-default-skin');
videojs(video, playerConfig);
}
// }
}
</script>
</body>
</html>

View file

@ -19,6 +19,8 @@ AUDIO_OPUS="-acodec libopus -ac 2 -ar 48000 -ab 96k"
AUDIO_VORBIS="-acodec libvorbis -ac 2 -ar 48000 -ab 128k"
AUDIO_AAC="-ac 2 -ar 48000 -ab 128k"
AUDIO_MP3="-acodec libmp3lame -ac 2 -ar 48000 -ab 128k"
AUDIO_ALAC="-acodec alac -ac 2 -ar 48000"
AUDIO_FLAC="-af aformat=sample_fmts=s16 -acodec flac -ac 2 -ar 48000 -strict -2"
INFILE=caminandes-llamigos.webm
@ -32,6 +34,9 @@ ffmpeg -i $INFILE -vn $AUDIO_MP3 -y fmp4.audio.mpeg.mp3
#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
#ffmpeg -i $INFILE -vn $AUDIO_ALAC $AUDFLAGS -y fmp4.audio.alac.mp4
ffmpeg -i $INFILE -vn $AUDIO_FLAC $AUDFLAGS -y fmp4.audio.flac.mp4
#ffmpeg -i $INFILE -vn $AUDIO_ULAW $AUDFLAGS -y fmp4.audio.ulaw.mp4
# Video for HLS
@ -64,6 +69,10 @@ 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.audio.alac.mp4 > fmp4.audio.alac.mp4.m3u8
php extract-playlist.php fmp4.audio.flac.mp4 > fmp4.audio.flac.mp4.m3u8
php extract-playlist.php fmp4.audio.ulaw.mp4 > fmp4.audio.ulaw.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
@ -102,3 +111,8 @@ php meta-playlist.php --lie fmp4 audio.opus.mp4 $MPEG_TRACK 480p.vp9.mp4 120p.mj
php meta-playlist.php fmp4 audio.opus.mp4 audio.mpeg.mov 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov-mp3.mov.m3u8
php meta-playlist.php fmp4 audio.opus.mp4 audio.mpeg.mp4 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov-mp3.mp4.m3u8
php meta-playlist.php fmp4 audio.opus.mp4 audio.alac.mp4 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov-alac.m3u8
php meta-playlist.php fmp4 audio.opus.mp4 audio.flac.mp4 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov-flac.m3u8
php meta-playlist.php fmp4 audio.opus.mp4 audio.mpeg.mp3 audio.flac.mp4 480p.vp9.mp4 120p.mjpeg.mov > fmp4.vp9-mjpeg.mov-opus-mp3-flac.m3u8

View file

@ -21,6 +21,9 @@ $audioCodecs = [
'aac' => 'mp4a.40.2',
'opus' => 'opus',
'alac' => 'alac',
'flac' => 'flac',
'ulaw' => 'ulaw',
'alaw' => 'alaw',
];
// @fixme use correct settings based on the file