This commit is contained in:
Brooke Vibber 2023-03-08 12:03:23 -08:00
parent a3844d9c44
commit cab52f32f9
2 changed files with 37 additions and 4 deletions

31
fmp4.html Normal file
View file

@ -0,0 +1,31 @@
<!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>
<p>WebM VP9 and VP8 in front, HLS with VP9-in-MP4 video with Opus-in-MP4 or AAC audio behind.</p>
<video controls width=640 height=360>
<source type="video/webm; codecs=&quot;vp9, opus&quot;" src=new-vp9.webm>
<source type="video/webm; codecs=&quot;vp8, vorbis&quot;" src=new-vp8.webm>
<source type=application/vnd.apple.mpegurl src=fmp4.vp9.m3u8>
</video>
<p>HLS VP9+Opus or VP9+MP3, no fallbacks:</p>
<video controls width=640 height=360>
<source type=application/vnd.apple.mpegurl src=fmp4.vp9.m3u8>
</video>
<p>HLS VP9+Opus or VP9+MP3, with h.264 fallback:</p>
<video controls width=640 height=360>
<source type=application/vnd.apple.mpegurl src=fmp4.vp9-h264.m3u8>
</video>
</body>
</html>

View file

@ -42,20 +42,22 @@ while ( count( $argv ) > 0 ) {
$videoCodecs[$codec], $videoCodecs[$codec],
$audioCodecs[$audioCodec], $audioCodecs[$audioCodec],
] ); ] );
$line = "$baseLine,CODECS=\"$codecs\""; $video[] = "$baseLine,CODECS=\"$codecs\"";
$video[] = $playlist;
} }
} else { } else {
$codecs = $videoCodecs[$codec]; $codecs = $videoCodecs[$codec];
$line = "$baseLine,CODECS=\"$codecs\",AUDIO=\"$audioCodec\""; $video[] = "$baseLine,CODECS=\"$codecs\",AUDIO=\"$audioCodec\"";
$video[] = $playlist;
} }
} }
} }
$lines = array_concat( $lines = array_merge(
[ '#EXTM3U' ], [ '#EXTM3U' ],
array_values( $audio ), array_values( $audio ),
$video $video
); );
$m3u8 = implode( "\n", $lines ); $m3u8 = implode( "\n", $lines );
print $m3u8; print "$m3u8\n";