[Libav-user] libav not decrypting hls with custom IO

Arminas g.arminas at gmail.com
Tue Nov 20 09:22:20 EET 2018

Hi all,

we're using libav* binded to custom IO, so it's possible to use our http
client instead of libav* one. I've noticed that application is not even
trying to decrypt HLS + AES* chunks and fails with exception "Error when
loading first segment". The loop:
1. Bind io_open, io_close, seek, read functions to our custom ones;
2. When executed, playlist is parsed, "iv" and "key" values are stored in
libav* options/dictionary;
3. After creating new IO context for 1st segment, Read callback is called
multiple times and we are filling buffer with bytes received from http
server (encrypted bytes);
4. After few loops, exception "Error when loading first segment" is thrown.

It seems that app has to make an explicit call to crypto module in Read
callback, or decrypt chunks itself before filling the buffer in Read
callback. Which scenario would you recommend?

Tried with ffmpeg versions 3.4.2 and 4.0.1. We're using javacpp presets to
communicate with libav. Our app works with unencrypted hls fine.

Any help is appreciated.

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

More information about the Libav-user mailing list