[libav-tools] Using -header parameter

Tim Fischer timfischer48 at googlemail.com
Sun Sep 9 11:46:13 CEST 2018


Hi,

i've some problem using the -header option to parse Cookies to a HLS server:

I'm using the following command line options:
avconv -user_agent 'Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101
Firefox/10.0' -headers 'Cookie: CloudFront-Policy=...;
CloudFront-Signature=...; CloudFront-Key-Pair-Id=...' -i '
http://hls-server/live.m3u8?seek=0&buffer=20' -vcodec h264 -r 10 -s 480x320
-strict experimental -acodec aac -ar 22050 -f flv rtmp://
127.0.0.1/nginx-rtmp

It seems to be that avconv is parsing the cookies only for first request
and not for the following requests to get the ts-files
The 1st reply from HLS Server are the ts-Files. But to get them the Cookie
parameter needs to be send, too.

I checked this using:
tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) -
((tcp[12]&0xf0)>>2)) != 0)'

1st Request:
GET /hls/S01/1/250/live.m3u8?seek=0&buffer=20 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101
Firefox/10.0
Accept: */*
Range: bytes=0-
Connection: close
Host: live-s01[..]
Icy-MetaData: 1
Cookie: CloudFront-Policy=[..] <--- COOKIES ARE SEND !


Response:
.(.$.^..HTTP/1.1 206 Partial Content
Content-Type: application/vnd.apple.mpegurl
Content-Length: 258
Connection: close
Date: Sun, 09 Sep 2018 09:27:43 GMT
Server: nginx
Last-Modified: Sun, 09 Sep 2018 09:27:43 GMT
Expires: Sun, 09 Sep 2018 09:27:45 GMT
X-Pooq-Stream-Type: Live
Content-Range: bytes 0-257/258
X-Cache: Miss from cloudfront
Via: 1.1 [..] (CloudFront)
X-Amz-Cf-Id: [..]

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:768242616
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:3
#EXTINF:2.0,
live_768242616.ts
#EXTINF:2.0,
live_768242617.ts
#EXTINF:2.0,
live_768242618.ts
#EXTINF:2.0,
live_768242619.ts
#EXTINF:2.0,
live_768242620.ts

Next request:
GET /hls/S01/1/250/live_768242618.ts HTTP/1.1
User-Agent: Lavf/56.1.0
Accept: */*
Range: bytes=0-
Connection: close
Host: live-s01.cdn.pooq.co.kr
Icy-MetaData: 1
<--- COOKIES ARE MISSING !

Response:
HTTP: HTTP/1.1 403 Forbidden

Is there any option to keep headsers for ts-requests?

~/libav-11.11# avconv
avconv version 11.12-6:11.12-1~deb8u1, Copyright (c) 2000-2018 the Libav
developers
  built on Feb 18 2018 20:26:27 with gcc 4.9.2 (Debian 4.9.2-10)
Hyper fast Audio and Video encoder


Thanks
Tim Fischer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-tools/attachments/20180909/3752ccfe/attachment.html>


More information about the libav-tools mailing list