I am using React (typescript) and I want to download m3u8 HLS livestream as a single mp4 video. How can I achieve this.
I am providing a sample m3u8 file below:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI="https://example.com/api/hlskey?videoKey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&key=enc.key"
#EXTINF:6.000000,
000.ts
#EXTINF:6.000000,
001.ts
#EXTINF:6.000000,
002.ts
#EXTINF:6.000000,
003.ts
#EXTINF:5.766667,
004.ts
#EXTINF:6.000000,
005.ts
#EXTINF:6.000000,
006.ts
#EXTINF:6.000000,
007.ts
#EXTINF:6.000000,
008.ts
#EXTINF:6.000000,
009.ts
#EXTINF:6.000000,
010.ts
#EXTINF:6.000000,
011.ts
#EXTINF:6.000000,
012.ts
#EXTINF:6.000000,
013.ts
#EXTINF:6.000000,
014.ts
#EXTINF:6.000000,
015.ts
#EXTINF:6.000000,
016.ts
#EXTINF:6.000000,
017.ts
#EXTINF:6.000000,
018.ts
#EXTINF:6.000000,
019.ts
#EXTINF:5.566667,
020.ts
#EXTINF:4.500000,
021.ts
#EXTINF:6.000000,
022.ts
#EXTINF:1.600000,
023.ts
#EXT-X-ENDLIST
I have tried to do this using @ffmpeg/ffmpeg
but it did not work. Please suggest a solution to this problem. Thanks in advance for your help.