Hello, I'm trying to use ffmpeg to download a 4k stream from lukyou.com. The official way to watch the stream is:
1. Install their proprietary lukyou player program(
https://lukyou.com/download), which register hrcp links to be sent to the player. The hrcp is nothing special, just a protocol to call the player.
2. Open the video page and click the play button(the play button only appears when you access the page via a Japanese IP). The page for the video I'm trying to download is
https://lukyou.com/content/detail/2J3DLS9KUT79CWH2. Incidentally you can fool the location-check script by adding a CLIENT-IP header with a Japanese IP as the value(easily done in Firefox with IPFlood).
3. Clicking the button initiates an ajax request which create an hrcp link with parameters to a hrcm file. The hrcp link looks like
hrcp://cdn.lukyou.com/at-jam/150829_nagoya/06_idorenaissance/pc/prodJP-hrc_meta.hrcm?token=6fb59c6a676b2475eca9143c32b7e9 10ac2eb469482799be9ae057487731e608&et=3756&lu=http ://lukyou.com/api/log/455081f67b6261d5e6dd0501b0506965f1772d48. The hrcm file for the stream I'm trying to download is
http://cdn.lukyou.com/at-jam/150829_...-hrc_meta.hrcm (this link is not geoblocked). The hrcm file contain relative links to the audio m3u8 and video m3u8's(multiple video playlists for the player's zoom feature where the video will be downloaded through the higher quality playlists when you zoom in). You can view the hrcm file in a browser if you replace hrcp with http.
4. The player parses the hrcp link and begins playing.
So it's rather easy to get the m3u8 playlist URLs(for example
http://cdn.lukyou.com/at-jam/150829_...-A-L0-0-0.m3u8) but the problem is that for some reason accessing the key file for decrypting the segments returns with an SSL handshake error.
Using ffmpeg-20150901-git-b54e03c-win32-static(later versions give me opencl.dll not found error) from
http://ffmpeg.zeranoe.com/builds/win32/static/:
Code:
C:\Tools\ffmpeg\bin>ffmpeg -i http://cdn.lukyou.com/at-jam/150829_nagoya/06_idorenaissance/pc/out/m3u8/prodJP-pc-A-L0-0-0.m3u8 -c copy lukyou_test.ts
ffmpeg version N-74751-gb54e03c Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 59.100 / 56. 59.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.100 / 5. 40.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[https @ 048286e0] No trailing CRLF found in HTTP header.
[tls @ 04824e20] Rehandshake was requested by the peer.
Unable to open key file https://lukyou.com/api/key/2J3DLS9KUT79CWH2/pc-channel01-A-L0-0-0-key.bin
Format aac detected only with low score of 1, misdetection possible!
<a lot of errors from misdetecting encrypted ts as aac>
[crypto @ 05933820] Unable to open resource: http://cdn.lukyou.com/at-jam/150829_nagoya/06_idorenaissance/pc/out/src/A-L0-0-0/seg00001.ts
http://cdn.lukyou.com/at-jam/150829_nagoya/06_idorenaissance/pc/out/m3u8/prodJP-pc-A-L0-0-0.m3u8: Immediate exit requested
Exiting normally, received signal 2.
Directly accessing
https://lukyou.com/api/key/2J3DLS9KU...L0-0-0-key.bin with web browsers also return SSL handshake errors. With Firefox it gives "SSL peer was unable to negotiate an acceptable set of security parameters. (Error code: ssl_error_handshake_failure_alert)". Note that the actual lukyou.com site itself works fine, only URLs from
https://lukyou.com/api/key/ downward gives the SSL error.
I believe this is related to the client.pem and client.key(possibly also the cacert.pem?) cert files bundled with the installer for the player, and have unpacked the lukyou2.0.0s.msi(latest version as of writing) installer file here for everyone to check
http://www1.axfc.net/u/3533474. From reading
https://www.ffmpeg.org/ffmpeg-protocols.html#tls, I guess I'm supposed to use the cert_file and key_file options, but I have no idea how to pass the m3u8 link to the tls:// protocol, plus the m3u8 is on plain
http://cdn.lukyou.com while it's the key file that's on the secure
https://lukyou.com.
I would appreciate it if somebody more knowledgeable than me could help with downloading the stream.