fent / node-m3u8stream

Concatenates segments from a m3u8/dash-mpd playlist into a consumable stream.
MIT License
217 stars 54 forks source link

Does'nt download the video but another m3u8 file #28

Open Tazeg opened 5 years ago

Tazeg commented 5 years ago

Try this :

const fs = require('fs');
const m3u8stream = require('m3u8stream')

m3u8stream('https://prod-fastly-eu-central-1.video.periscope.tv/Transcoding/v1/hls/rR3sEEtIYIXRbEx5ThxVpftu1BX4T8UN_x8ObMCkkhMy4Bg9F0bnU5nzMQVSfrmqMk0-_tGWcx3niQ9R5-0yxA/non_transcode/eu-central-1/periscope-replay-direct-prod-eu-central-1-public/master_dynamic_16889594913756400541.m3u8?type=replay').pipe(fs.createWriteStream('videofile.mp4'));

It downloads another m3u8 file but not the video. As i understand that's because the given url contains several type of videos :

#EXTM3U
#EXT-X-DYNAMICALLY-GENERATED
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000,RESOLUTION=480x270, CODECS="avc1.640015,mp4a.40.2"
/Transcoding/v1/hls/rR3sEEtIYIXRbEx5ThxVpftu1BX4T8UN_x8ObMCkkhMy4Bg9F0bnU5nzMQVSfrmqMk0-_tGWcx3niQ9R5-0yxA/transcode/eu-central-1/periscope-replay-direct-prod-eu-central-1-public/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0.eyJIZWlnaHQiOjI3MCwiS2JwcyI6NTAwLCJXaWR0aCI6NDgwfQ.0PLzHwJpzC4wA_jNo8XOma8zOx8uPmEDTD3WKSRLYOA/playlist_16889594913756400541.m3u8?type=replay
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000000,RESOLUTION=848x480, CODECS="avc1.64001e,mp4a.40.2"
/Transcoding/v1/hls/rR3sEEtIYIXRbEx5ThxVpftu1BX4T8UN_x8ObMCkkhMy4Bg9F0bnU5nzMQVSfrmqMk0-_tGWcx3niQ9R5-0yxA/transcode/eu-central-1/periscope-replay-direct-prod-eu-central-1-public/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0.eyJIZWlnaHQiOjQ4MCwiS2JwcyI6MTAwMCwiV2lkdGgiOjg0OH0.RFzmPpRYVt-M5xPGoWoifZwAR5Wj0QbokQ2FVsxVt9c/playlist_16889594913756400541.m3u8?type=replay
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2000000,RESOLUTION=1280x720, CODECS="avc1.64001f,mp4a.40.2"
/Transcoding/v1/hls/rR3sEEtIYIXRbEx5ThxVpftu1BX4T8UN_x8ObMCkkhMy4Bg9F0bnU5nzMQVSfrmqMk0-_tGWcx3niQ9R5-0yxA/transcode/eu-central-1/periscope-replay-direct-prod-eu-central-1-public/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0.eyJIZWlnaHQiOjcyMCwiS2JwcyI6MjAwMCwiV2lkdGgiOjEyODB9.RYzh5rWQLNy-ZB1zO_EREmt9fkjSnJS2If9o7Ls4vOM/playlist_16889594913756400541.m3u8?type=replay
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4000000,RESOLUTION=1280x720, CODECS="avc1.64001f,mp4a.40.2"
/Transcoding/v1/hls/rR3sEEtIYIXRbEx5ThxVpftu1BX4T8UN_x8ObMCkkhMy4Bg9F0bnU5nzMQVSfrmqMk0-_tGWcx3niQ9R5-0yxA/transcode/eu-central-1/periscope-replay-direct-prod-eu-central-1-public/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0.eyJIZWlnaHQiOjcyMCwiS2JwcyI6NDAwMCwiV2lkdGgiOjEyODB9._lwcUhHeo_ZcTvj7C11_mnFYldhjIywdpF0kk3OHkBE/playlist_16889594913756400541.m3u8?type=replay

Can you set by default to get for example the first one ?

fent commented 5 years ago

This module only works on media m3u8 playlists, not master playlists. There is a note about this in the readme

https://github.com/fent/node-m3u8stream#limitations

Tazeg commented 5 years ago

In this case could you fire an event or an error so that i can manage with another way ?

fent commented 5 years ago

sure