webm opus

This commit is contained in:
Brooke Vibber 2021-10-27 12:58:33 -07:00
parent 10a001d01c
commit 9d782dc963
3 changed files with 14 additions and 5 deletions

View file

@ -75,7 +75,7 @@
if (typeof MediaSource == 'function') {
let codecs = [
['VP9-in-MP4', 'video/mp4; codecs="vp09.00.10.08"'],
['Opus-in-MP4', 'audio/mp4; codecs="opus"'],
['Opus-in-WebM', 'audio/webm; codecs="opus"'],
['MP3', 'audio/mp3'],
];
let yes = [];
@ -115,7 +115,7 @@
</script>
<script src=ogvjs-1.8.4/ogv.js></script>
<script src=video-js/alt/video.core.js></script>
<script src=videojs-http-streaming.es.js></script>
<script src=videojs-http-streaming.js></script>
<script src=videojs-ogvjs.js></script>
<script>
var playerConfig = {
@ -134,7 +134,7 @@
return (typeof MediaSource == 'function') && MediaSource.isTypeSupported(mime);
}
var vp9 = can('video/mp4; codecs="vp09.00.10.08"');
var opus = can('audio/mp4; codecs="opus"');
var opus = can('audio/webm; codecs="opus"');
var aac = can('audio/mp4; codecs="mp4a.40.02');
var mp3 = can('audio/mp3');
//var mp3 = can('audio/mp4; codecs="mp4a.40.34"');

View file

@ -32,7 +32,7 @@ class Audio {
],
],
'opus' => [
'container' => 'mp4',
'container' => 'webm',
'options' => [
'-acodec', 'libopus',
'-ar', 48000,
@ -231,6 +231,13 @@ class Transcoder {
'-segment_list', $playlist,
'-y', $segment
];
} elseif ( $container == 'webm' ) {
$segmentOptions = [
'-f', 'segment',
'-segment_time', '10',
'-segment_list', $playlist,
'-y', $segment
];
} else {
die( 'missing container in config' );
}
@ -304,6 +311,7 @@ foreach ( $infiles as $filename ) {
$source = new SourceFile( $filename );
$codec = new Transcoder( $source );
$codec->audio('opus');
/*
$codec->audio('mp3');
$codec->audio('aac');
foreach ( Video::FORMATS['vp9']['resolutions'] as $res => $format ) {
@ -317,4 +325,5 @@ foreach ( $infiles as $filename ) {
$codec->video('vp9', $res, 'pass2');
}
}
*/
}

View file

@ -1,2 +1,2 @@
(cd ~/src/media/http-streaming && npm ci) && cp ~/src/media/http-streaming/dist/videojs-http-streaming.es.js .
(cd ~/src/media/http-streaming && npm ci) && cp ~/src/media/http-streaming/dist/videojs-http-streaming.js .