A localização do arquivo m3u8
é
https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720.m3u8?Policy=eyJTd....._&Signature=S7pry.....__&Key-Pair-Id=APKAIB5DGCGAQJ4GGIUQ
O 720.key
está em
https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720.key?Policy=eyJTd....._&Signature=S7pry.....__&Key-Pair-Id=APKAIB5DGCGAQJ4GGIUQ
se eu estiver usando ffmpeg -i "https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720.m3u8?Policy=eyJTd....._&Signature=S7pry.....__&Key-Pair-Id=APKA..... -c copy 01.ts
para fazer o download da playlist. Ele obterá um HTTP error 403 Forbidden
para seu arquivo key
e ts
[https @ 000000000364d8c0] HTTP error 403 Forbidden
Unable to open key file https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720.key
[hls,applehttp @ 00000000005ec180] Opening 'crypto+https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720_00000.ts' for rea
ding
[https @ 000000000364cc80] HTTP error 403 Forbidden
[crypto @ 0000000003695dc0] Unable to open resource: https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720_00000.ts
[hls,applehttp @ 00000000005ec180] Failed to open segment 0 of playlist 0
[hls,applehttp @ 00000000005ec180] Opening 'crypto+https://hls2.videos.sproutvideo.com/4c6...../b24db8.../video/720_00001.ts' for rea
ding
E então descobri que os recursos só podem ser acessados por alguma string de consulta especificada. Nesse caso, seria ?Policy=eyJTd....._&Signature=S7pry.....__&Key-Pair-Id=APKAIB5DGCGAQJ4GGIUQ
Minha pergunta é como colocar uma string de consulta única em cada ts
e key
arquivos, para que o ffmpeg possa baixá-la.
O conteúdo do arquivo 720.m3u8
:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI="720.key",IV=0x2f1fb3a9fd334f2babb6cc77f7753129
#EXTINF:10.000000,
720_00000.ts
#EXTINF:10.000000,
720_00001.ts
#EXTINF:10.000000,
720_00002.ts
#EXTINF:10.000000,
720_00003.ts
#EXTINF:8.733333,
720_00004.ts
#EXT-X-ENDLIST