ffmpegwasm / ffmpegwasm/ffmpeg.wasm

How to get HLS stream format output files from ffmpeg?

Đang mở
#218 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
17.8k
Fork
1.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I want to convert a input file into HLS stream format and then for each part of the file upload it to IPFS. The problem is I can't just call ` ffmpeg.FS('readFile', 'part_001.ts') `because I don't know how many `part_xxx.ts` files there will be. So how to do in this case?

```

//navigator.serviceWorker.register('/ffmpeg.min.js');
//navigator.serviceWorker.register('/ffmpeg-core.js');

const { createFFmpeg, fetchFile } = FFmpeg;
const ffmpeg = createFFmpeg({
corePath: 'https://unpkg.com/@ffmpeg/core@0.10.0/dist/ffmpeg-core.js',
log: true,
});

ffmpeg.setLogger(({ type, message }) => {
console.log(type, message);
});

const transcode = async ({ target: { files } }) => {
console.log('Running ffmpeg')
const { name } = files[0];
await ffmpeg.load();
ffmpeg.FS('writeFile', name, await fetchFile(files[0]));
await ffmpeg.run('-i', name, '-hls_time', '10', '-hls_playlist_type', 'vod', '-hls_segment_filename', 'part_%03d.ts', 'master.m3u8');
// ffmpeg -i name -hls_time 10 -hls_playlist_type vod -hls_segment_filename part_%03d.ts master.m3u8

}
document.getElementById('uploader').addEventListener('change', transcode);

```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.