wip trying with segment muxer

not having luck with the fmp4
just gonna stick with hls i think
This commit is contained in:
Brooke Vibber 2023-02-17 16:51:21 -08:00
commit b14806a74b
5 changed files with 61 additions and 4 deletions

View file

@ -59,7 +59,7 @@ function hexdump($str) {
const KHZ_90 = 90000;
const MHZ_27 = 27000000;
function process_mp3( $filename, $pts ) {
function process_mp3( $filename, $data, $pts ) {
$owner = "com.apple.streaming.transportStreamTimestamp\x00";
$timestamp = $pts * KHZ_90;
$timestamp_high = 0;
@ -99,7 +99,6 @@ function process_mp3( $filename, $pts ) {
$hex = hexdump($tag);
print "$filename $pts $hex\n";
$data = file_get_contents( $filename );
return "$tag$data";
}
@ -111,6 +110,7 @@ $self = array_shift( $args );
$playlist = array_shift( $args );
$playlist_out = $playlist;
$outfile = array_shift( $args );
$process_mp3 = preg_match('/\.mp3$/i', $outfile);
$lines = file( $playlist, FILE_IGNORE_NEW_LINES + FILE_SKIP_EMPTY_LINES );
@ -153,7 +153,10 @@ foreach ( $lines as $line ) {
continue;
}
$filename = $line;
$chunk = process_mp3( $filename, $pts );
$chunk = file_get_contents( $filename );
if ( $process_mp3 ) {
$chunk = process_mp3( $filename, $chunk, $pts );
}
$len = strlen( $chunk );
$lines_out[] = "#EXT-X-BYTERANGE:$len@$offset";
$lines_out[] = "$outfile";