mirror of
https://github.com/davedoesdev/streamana.git
synced 2025-10-05 13:36:50 +08:00
Add rotation metadata if initially in portrait mode
YouTube ignores it though - only supports landscape
This commit is contained in:
@@ -180,7 +180,7 @@ async function start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// start HLS from the canvas stream to the ingestion URL
|
// start HLS from the canvas stream to the ingestion URL
|
||||||
hls = new HLS(canvas_stream, ingestion_url, ffmpeg_lib_url, frame_rate);
|
hls = new HLS(canvas_stream, ingestion_url, ffmpeg_lib_url, frame_rate, portrait);
|
||||||
hls.addEventListener('run', () => console.log('HLS running'));
|
hls.addEventListener('run', () => console.log('HLS running'));
|
||||||
hls.addEventListener('exit', ev => {
|
hls.addEventListener('exit', ev => {
|
||||||
const msg = `HLS exited with status ${ev.detail.code}`;
|
const msg = `HLS exited with status ${ev.detail.code}`;
|
||||||
|
@@ -3,15 +3,16 @@ import { MuxReceiver } from './mux-receiver.js';
|
|||||||
|
|
||||||
const audioBitsPerSecond = 128 * 1000;
|
const audioBitsPerSecond = 128 * 1000;
|
||||||
const videoBitsPerSecond = 2500 * 1000;
|
const videoBitsPerSecond = 2500 * 1000;
|
||||||
const key_frame_interval = 10;
|
const key_frame_interval = 3;
|
||||||
|
|
||||||
export class HLS extends EventTarget {
|
export class HLS extends EventTarget {
|
||||||
constructor(stream, base_url, ffmpeg_lib_url, frame_rate) {
|
constructor(stream, base_url, ffmpeg_lib_url, frame_rate, portrait) {
|
||||||
super();
|
super();
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
this.base_url = base_url;
|
this.base_url = base_url;
|
||||||
this.ffmpeg_lib_url = ffmpeg_lib_url;
|
this.ffmpeg_lib_url = ffmpeg_lib_url;
|
||||||
this.frame_rate = frame_rate;
|
this.frame_rate = frame_rate;
|
||||||
|
this.portrait = portrait;
|
||||||
this.update_event = new CustomEvent('update');
|
this.update_event = new CustomEvent('update');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +256,7 @@ export class HLS extends EventTarget {
|
|||||||
'-map', '0:v',
|
'-map', '0:v',
|
||||||
'-map', '0:a',
|
'-map', '0:a',
|
||||||
'-c:v', 'copy', // pass through the video data (h264, no decoding or encoding)
|
'-c:v', 'copy', // pass through the video data (h264, no decoding or encoding)
|
||||||
|
...(this.portrait ? ['-metadata:s:v:0', 'rotate=-90'] : []),
|
||||||
'-c:a', 'aac', // re-encode audio as AAC-LC
|
'-c:a', 'aac', // re-encode audio as AAC-LC
|
||||||
'-b:a', audioBitsPerSecond.toString() // set audio bitrate
|
'-b:a', audioBitsPerSecond.toString() // set audio bitrate
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user