[Libav-user] ffmpeg hls and 3 cookies SOLVED

Georg Stein SMC georg at steinmc.com
Thu Jan 5 19:27:13 EET 2017


ok i got it to work now.

i set now the cookie like this:

coded in Qt/C++

QStringcookieString="Cookie:";

cookieString+="CloudFront-Policy="+cloudFrontPolicy+";";

cookieString+="CloudFront-Key-Pair-Id="+cloudFrontKeyID+";";

cookieString+="CloudFront-Signature="+cloudFrontSignature+";"; then i 
add it to the dict object:
std::stringcookieString=cookies.toStdString()+"\r\n"; 
av_dict_set(&avoption,"headers",cookieString.c_str(),AV_DICT_APPEND); 
the important thing is to put the \r\n in after the QString is converted 
to a std:string then it works Georg


Am 05.01.2017 um 18:05 schrieb Uğur Bozkaya:
> Ok this is the http request that you are making right? If that is the 
> case, request header should have “Cookie:” not “Set-Cookie” in them, 
> because “Set-Cookie” is a header that is received from the web servers 
> that makes your client create and save that cookie on your machine 
> locally. Regarding the CRLF are you adding one also at the end? 
> According to http there will be one CRLF at the end of each header and 
> one additional CRLF between the last header and the request body. So i 
> would suggest you to try adding one or two CRLF at the end of the last 
> header. Also have you tried passing the same parameters(cookies, etc) 
> with wget and curl to download the file?
>
> Ugur
>
>
>
>
>> On Jan 4, 2017, at 2:58 PM, Georg Stein SMC <georg at steinmc.com 
>> <mailto:georg at steinmc.com>> wrote:
>>
>> Hello,
>>
>> in the log i get: (tried with '$'\r\n, \r\n, \n and all other 
>> combinations i could imagine to get the CRLF)
>>
>> [https @ 02fd0b20] No trailing CRLF found in HTTP header.
>>
>> [https @ 02fd0b20] request: GET 
>> /rZ_8XnNryXVVp73bJlmNVVwFWdKICm0MlwrhdOzPY0V8oyT3f_Z_gnGbERz4hDD8sOslHQ5XFSiGrJaekYWMZg/playlist_1482892547484600267.m3u8 
>> HTTP/1.1
>> User-Agent: Lavf/56.7.104
>> Accept: */*
>> Range: bytes=0-
>> Connection: close
>> Host: replay.periscope.tv
>> Icy-MetaData: 1
>> Set-Cookie: 
>> CloudFront-Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9yZXBsYXkucGVyaXNjb3BlLnR2L3JaXzhYbk5yeVhWVnA3M2JKbG1OVlZ3RldkS0lDbTBNbHdyaGRPelBZMFY4b3lUM2ZfWl9nbkdiRVJ6NGhERDhzT3NsSFE1WEZTaUdySmFla1lXTVpnKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTQ4MzY0NTkwN319fV19;CloudFront-Key-Pair-Id=APKAIHCXHHQVRTVSFRWQ;CloudFront-Signature=gFwMd9Q4lBGK8asN~XHrfn2ETGPcRlvL6yM43zMNmYmsuLx8PcnX34G21N14SMRve3-D~MPn175tuBBgjrU2zzGIkdAPZla8ISQyKqX4nWiucy~UMOvF2OuZdkHqR99tFGGb~Oe23~scXRgk-Ujxm4ZOKcd8Av44CN~B1X9uIxqOIHbnHiEoYLmh-t1DNfl1V-hPzJ3-TdA9VUwGGYEm8pz430Muo6DJoDX03f~AcTaz91IP81aW4CqZSPWgXzmc656qSRCwbth9qQ-JT~Pf69QH~bJHpQQZDsRueJMw5XFlzsAOFl6yQNJOlEwzRa41lfuWAOoPQOKuKW2DoRm89g__;
>>
>>
>> [tls @ 004cf280] error:00000000:lib(0):func(0):reason(0)
>> [https @ 02fd0b20] No trailing CRLF found in HTTP header.
>> [https @ 02fd0b20] request: GET 
>> /rZ_8XnNryXVVp73bJlmNVVwFWdKICm0MlwrhdOzPY0V8oyT3f_Z_gnGbERz4hDD8sOslHQ5XFSiGrJaekYWMZg/playlist_1482892547484600267.m3u8 
>> HTTP/1.1
>> User-Agent: Lavf/56.7.104
>> Accept: */*
>> Range: bytes=0-
>> Connection: close
>> Host: replay.periscope.tv
>> Icy-MetaData: 1
>> Set-Cookie: 
>> CloudFront-Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9yZXBsYXkucGVyaXNjb3BlLnR2L3JaXzhYbk5yeVhWVnA3M2JKbG1OVlZ3RldkS0lDbTBNbHdyaGRPelBZMFY4b3lUM2ZfWl9nbkdiRVJ6NGhERDhzT3NsSFE1WEZTaUdySmFla1lXTVpnKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTQ4MzY0NTkwN319fV19;CloudFront-Key-Pair-Id=APKAIHCXHHQVRTVSFRWQ;CloudFront-Signature=gFwMd9Q4lBGK8asN~XHrfn2ETGPcRlvL6yM43zMNmYmsuLx8PcnX34G21N14SMRve3-D~MPn175tuBBgjrU2zzGIkdAPZla8ISQyKqX4nWiucy~UMOvF2OuZdkHqR99tFGGb~Oe23~scXRgk-Ujxm4ZOKcd8Av44CN~B1X9uIxqOIHbnHiEoYLmh-t1DNfl1V-hPzJ3-TdA9VUwGGYEm8pz430Muo6DJoDX03f~AcTaz91IP81aW4CqZSPWgXzmc656qSRCwbth9qQ-JT~Pf69QH~bJHpQQZDsRueJMw5XFlzsAOFl6yQNJOlEwzRa41lfuWAOoPQOKuKW2DoRm89g__;
>>
>>
>>
>> Am 04.01.2017 um 19:05 schrieb Uğur Bozkaya:
>>> The only suggestion I can make is that build the debug libraries and 
>>> debug the code. The version I have is below but I have never played 
>>> with cookies in my code.
>>>
>>> libavutil      55. 17.103 / 55. 17.103
>>>   libavcodec     57. 24.102 / 57. 24.102
>>>   libavformat    57. 25.100 / 57. 25.100
>>>   libavdevice 57.  0.101 / 57.  0.101
>>>   libavfilter     6. 31.100 /  6. 31.100
>>>   libswscale 4.  0.100 /  4.  0.100
>>>   libswresample 2.  0.101 /  2.  0.101
>>>   libpostproc 54.  0.100 / 54.  0.100
>>>
>>> Btw are you sure that cookies are not set in the http request. Are 
>>> you looking into the raw http request that is being made? Is it 
>>> possible that they are there but invalid?
>>>
>>> Ugur
>>>
>>>
>>>> On Jan 4, 2017, at 12:37 PM, Georg Stein SMC <georg at steinmc.com 
>>>> <mailto:georg at steinmc.com>> wrote:
>>>>
>>>> thanks for the tip,
>>>>
>>>> i tried this but its not working here, what version of ffmpeg do 
>>>> you use
>>>>
>>>>
>>>> Georg
>>>>
>>>>
>>>> Am 04.01.2017 um 16:46 schrieb Uğur Bozkaya:
>>>>> One more suggestion,
>>>>>
>>>>> here 
>>>>> (https://github.com/FFmpeg/FFmpeg/blob/845bb401781ef04e342bd558df16a8dbf5f800f9/libavformat/http.c) 
>>>>> it says
>>>>> char*cookies; ///< holds newline (\n) delimited Set-Cookie header 
>>>>> field values (without the "Set-Cookie: " field name)
>>>>> So may be you can try starting the cookie string 
>>>>> with “Set-Cookie:” instead of “Cookie:" and use '\n’ as the delimeter.
>>>>>
>>>>> I don’t have the project on my machine so I can not test it sorry 
>>>>> for that.
>>>>>
>>>>> Hope this helps,
>>>>>
>>>>> Ugur
>>>>>
>>>>>> On Jan 3, 2017, at 11:15 PM, Georg Stein SMC <georg at steinmc.com 
>>>>>> <mailto:georg at steinmc.com>> wrote:
>>>>>>
>>>>>> this makes no difference and by the way at the command line with 
>>>>>> ffmpeg everything works with my cookie string below. I only do 
>>>>>> not figure out how to put it into avformat in my code
>>>>>>
>>>>>>
>>>>>> Georg
>>>>>>
>>>>>>
>>>>>> Am 04.01.2017 um 00:09 schrieb Uğur Bozkaya:
>>>>>>> Just a suggestion without any deep knowledge.
>>>>>>>
>>>>>>> Did you try to add a space after ‘;’ In the command line doc 
>>>>>>> (https://ffmpeg.org/ffmpeg-protocols.html#HTTP-Cookies) it seems 
>>>>>>> to have it for ffplay.
>>>>>>> ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com <http://somedomain.com/>;"http://somedomain.com/somestream.m3u8
>>>>>>>
>>>>>>> Ugur
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Jan 3, 2017, at 11:00 AM, Georg Stein SMC <georg at steinmc.com 
>>>>>>>> <mailto:georg at steinmc.com>> wrote:
>>>>>>>>
>>>>>>>> I have 3 cookies i need to hand over to the avformat lib, i 
>>>>>>>> tried this as an optione (see below) but without success, so 
>>>>>>>> perhasp somebody has a hint for me how i have to do this correct
>>>>>>>>
>>>>>>>> Georg
>>>>>>>>
>>>>>>>> i tried this way (under Qt 5, windows)
>>>>>>>>
>>>>>>>> cookies= "Cookie: 
>>>>>>>> CloudFront-Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9yZXBsYXkucGVyaXNjb3BlLnR2L3JaXzhYbk5yeVhWVnA3M2JKbG1OVlZ3RldkS0lDbTBNbHdyaGRPelBZMFY4b3lUM2ZfWl9nbkdiRVJ6NGhERDhzT3NsSFE1WEZTaUdySmFla1lXTVpnKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTQ4MzQ3MjYwMX19fV19;CloudFront-Key-Pair-Id=APKAIHCXHHQVRTVSFRWQ;CloudFront-Signature=CWCFrF5gKg-cCgxUWyN1c~rtHTL4Oor8cShBfWdbX4KmjFodsVgEHdMbwHP6cP8KYWL1oFD1Xq6SURLTFVQK3iW8XvIaogdq-Ef4vAElWumdHOGXdNxDMi-19yV2q0lDormiUCk4hp-TGhxlx3ojFYfUXpIPUJTgE3GoxLtGoS6Zu1hsS50zuy6Kbg~h~wa1MbHRgTAlq3QGMf1ECiJ3BO6j5xmxwJyiYwD~piqYOLU-~lTVeGHOll9oLl5YDidCfeU6ixWMiOSa0a6sejk7utZzYPHVRMsNUbYKh8SYxg50t7V06BHJ8Bdml8kh~d9Rt2epS49objhVEg56YBiE5w__;'$'\r\n'"
>>>>>>>>
>>>>>>>> and also without thr trainling $'\r\n'
>>>>>>>>
>>>>>>>> av_opt_set(&avoption,"headers",cookies.toStdString().c_str(),AV_DICT_APPEND);
>>>>>>>>
>>>>>>>>
>>>>>>>> but this is not working
>>>>>>>>
>>>>>>>> Georg
>>>>>>>>
>>>>>>>>
>>>>>>>> Am 03.01.2017 um 00:06 schrieb Anthony Ettinger:
>>>>>>>>> Can you install the static builds?https://johnvansickle.com/ffmpeg/
>>>>>>>>>
>>>>>>>>> On Mon, Jan 2, 2017 at 12:17 AM, Carl Eugen Hoyos<ceffmpeg at gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> 2017-01-01 19:57 GMT+01:00 Georg Stein SMC<georg at steinmc.com>:
>>>>>>>>>>
>>>>>>>>>>> ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
>>>>>>>>>>>    built with gcc 4.8 (SUSE Linux)
>>>>>>>>>> This is an intentionally broken binary that cannot be used for
>>>>>>>>>> anything!
>>>>>>>>>> Suse is abusing the name of our project in a similar way as Debian
>>>>>>>>>> and Ubuntu did in the past, there is nothing we can do about it;-(
>>>>>>>>>>
>>>>>>>>>> The solution for you is to switch to packman as package provider.
>>>>>>>>>>
>>>>>>>>>> Carl Eugen
>>>>>>>>>> _______________________________________________
>>>>>>>>>> ffmpeg-user mailing list
>>>>>>>>>> ffmpeg-user at ffmpeg.org
>>>>>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, visit link above, or email
>>>>>>>>>> ffmpeg-user-request at ffmpeg.org  with subject "unsubscribe".
>>>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Stein Micro Computer
>>>>>>>> Georg P. Stein
>>>>>>>>
>>>>>>>> Tel.: 06898-63880
>>>>>>>> Fax: 06898-63820
>>>>>>>> Mobil: 0172-3538379
>>>>>>>> georg at steimc.com
>>>>>>>> https://www.steinmc.com
>>>>>>>> _______________________________________________
>>>>>>>> Libav-user mailing list
>>>>>>>> Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>>>>>>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Libav-user mailing list
>>>>>>> Libav-user at ffmpeg.org
>>>>>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>>>>
>>>>>> -- 
>>>>>> Stein Micro Computer
>>>>>> Georg P. Stein
>>>>>>
>>>>>> Tel.: 06898-63880
>>>>>> Fax: 06898-63820
>>>>>> Mobil: 0172-3538379
>>>>>> georg at steimc.com
>>>>>> https://www.steinmc.com
>>>>>> _______________________________________________
>>>>>> Libav-user mailing list
>>>>>> Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>>>>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Libav-user mailing list
>>>>> Libav-user at ffmpeg.org
>>>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>>
>>>> -- 
>>>> Stein Micro Computer
>>>> Georg P. Stein
>>>>
>>>> Tel.: 06898-63880
>>>> Fax: 06898-63820
>>>> Mobil: 0172-3538379
>>>> georg at steimc.com
>>>> https://www.steinmc.com
>>>> _______________________________________________
>>>> Libav-user mailing list
>>>> Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>>
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>> -- 
>> Stein Micro Computer
>> Georg P. Stein
>>
>> Tel.: 06898-63880
>> Fax: 06898-63820
>> Mobil: 0172-3538379
>> georg at steimc.com
>> https://www.steinmc.com
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-- 
Stein Micro Computer
Georg P. Stein

Tel.: 06898-63880
Fax: 06898-63820
Mobil: 0172-3538379
georg at steimc.com
https://www.steinmc.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170105/883b224f/attachment.html>


More information about the Libav-user mailing list