retool mp3 id3 stuff for single-file

This commit is contained in:
Brooke Vibber 2021-11-03 10:43:29 -07:00
commit a105f49742
3 changed files with 31 additions and 16 deletions

View file

@ -209,12 +209,13 @@ class Transcoder {
private function ffmpeg( $options, $outfile, $container ) {
$playlist = "$outfile.m3u8";
$init = "$outfile.init.$container";
$segment = "$outfile.%04d.$container";
if ( $container == 'mp4' ) {
// HLS muxer seems to give the right options for fMP4
$segment = "$outfile.$container";
$segmentOptions = [
'-f', 'hls',
'-hls_segment_type', 'fmp4',
'-hls_flags', 'single_file',
'-hls_time', '10',
'-hls_playlist_type', 'vod',
'-hls_fmp4_init_filename', $init,
@ -223,7 +224,9 @@ class Transcoder {
];
} elseif ( $container == 'mp3' ) {
// For MP3, segment it raw.
// We'll need to postprocess to add an ID3 tag with timestamp.
// We'll need to postprocess to add an ID3 tag with timestamp
// and to reassemble into a file with byte ranges.
$segment = "$outfile.%04d.$container";
$segmentOptions = [
'-f', 'segment',
'-segment_format_options', 'id3v2_version=0:write_xing=0:write_id3v1=0',