MediaArea / MediaInfoLib

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://mediaarea.net/MediaInfo
BSD 2-Clause "Simplified" License
634 stars 174 forks source link

Support passing cookies from command line #792

Open fantapop opened 6 years ago

fantapop commented 6 years ago

I'm trying to use media info to request a url for an HLS playlist which is hosted on aws cloudfront. The cloudfront distribution is locked down and urls must be signed for access. MediaInfo works on files like mp4s which are a single file when urls are signed. However, I'm having trouble with the HLS files because the signature is not preserved in the index files. The initial index is able to be read but mediainfo then tries to grab each sub manifest file and fails. I've had success streaming the urls with our player by using cloudfronts signed cookies. If I could pass in a cookie string or a header via the command line to be passed along to the curl call this could work. Or maybe there's another way?

JeromeMartinez commented 6 years ago

If I could pass in a cookie string

You can provide some HTTP headers to MediaInfo with this (hidden, we are lacking documentation) option: mediainfo "--File_curl=HttpHeader,Cookie: blabla=blabla1;blabla2=blabla3"

I didn't test with AWS and HLS, in my opinion it would be better to natively support such case, but it would require some development.

fantapop commented 6 years ago

great! I saw the File stuff in the code but couldn't quite decipher how it was used. Thank you.