Discussion:
[Libav-user] libav not decrypting hls with custom IO
Arminas
2018-11-20 07:22:20 UTC
Permalink
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.
--
Regards,
Arminas
Carl Eugen Hoyos
2018-11-20 10:59:17 UTC
Permalink
Post by Arminas
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".
Did you test with ffmpeg (the application)?
I believe it will not work indicating the problem is not related to
your code, an initial patch was sent a few days ago iirc.

Carl Eugen
Arminas
2018-11-20 15:08:54 UTC
Permalink
Hello,
Post by Carl Eugen Hoyos
Post by Arminas
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".
Did you test with ffmpeg (the application)?
I believe it will not work indicating the problem is not related to
your code, an initial patch was sent a few days ago iirc.
Yes, if I run ffmpeg -i "http://....", it is able to show metadata and
stream information about video. Using custom IO, it crashes in
avformat_open_input() function. I'm just curious when using custom IO,
should user decrypt chunks at his application level, or somehow initialise
new context for crypto module.
Post by Carl Eugen Hoyos
Carl Eugen
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
--
Regards,
Arminas
Loading...