sim0n00ps / OF-DL

C# console app to download all of the media from Onlyfans accounts with DRM video downloading support
753 stars 65 forks source link

ffmpeg : Unrecognized option 'cenc_decryption_key' on Ubuntu 22.04 with internal ffmpeg lib #276

Closed peddanet closed 7 months ago

peddanet commented 7 months ago

Hi,

I am using OF DL v1.7.48 on an ubuntu system 22.o4 and generally it works brilliantly.I only have issues with decrypted files. The videos could not manually be downloade with JDownloader2 or Video Downloadhelper. Context menu of firefox is greyed out.

Downloading 5 Paid Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20%s:line 1004
                                                                         ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: 
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
Unrecognized option 'cenc_decryption_key'.
Error splitting the argument list: Option not found

Exception caught: Could not find file '~/of/da[..]30_source.mp4'.

StackTrace:    at System.IO.FileInfo.get_Length()
   at OF_DL.Helpers.DownloadHelper.DownloadDrmMedia(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String folder, DateTime lastModified, Int64 media_id, ProgressTask task, String customFileName, String filename, String path, Boolean showScrapeSize) in ~/Projects/OF_DL_1.7.48/OF DL/Helpers/DownloadHelper.cs:line 628
   at OF_DL.Helpers.DownloadHelper.DownloadPurchasedMessageDRMVideo(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String                                                                          filenameFormat, List messageInfo, Medium messageMedia, FromUser fromUser, Dictionary`2 users, Config config, Boolean showScrapeSizDownloading 5 Paid Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20%s:line 1004

So far done:

After the error first occured 3 weeks before (or at least I was aware because my file was not downloaded), I

The error stays as unrecognized. Google did not much help here related to ffmpeg.

Debugging: In the man page of ffmpeg I did not find any hint regarding that option and also in general for decryption there was only a hint to VOB decryption (totally different context seems)

In ./helper/DownloadHelper.csin line 596 this option is nevertheless instantiated and in line 604 it is called then in method DownloadDrmMedia(). The exception "file not found" (a successor error I guess) refers to line 628 which is funnily the end of this function.

I found on stackoverflow this solution suggestion putting the args not into a single string but in a list of args. But if the option is simply unknown to ffmpeg??

I was calling very simply:

~/Projects/OF_DL_1.7.48/OF DL/bin/release/net7.0/linux-x64/publish$ ffmpeg -cenc_decryption_key
ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: 
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
Unrecognized option 'cenc_decryption_key'.
Error splitting the argument list: Option not found

I assume an issue here. But if not, any help is appreciated!

peddanet commented 7 months ago

I add a

Log.Debug("ProcessStartInfo ffmpeg Arguments: $ffmpeg {0}", ffmpegStartInfo.Arguments);

in line 599 after ProcessStartInfo and it just prints this call (arguments):

2024-02-10 16:53:50.172 +01:00 [DBG] ProcessStartInfo ffmpeg Arguments: $ffmpeg -cenc_decryption_key 3[..]74db -headers "Cookie:CloudFront-                                          Policy=ey[..]fQ__; CloudFront-Signature=p[..]__;            CloudFront-Key-Pair-Id=K[..]3; auth_id=12[..]5; sess=ipk[..]9qk^M
 Origin: https://onlyfans.com^M
 Referer: https://onlyfans.com^M
 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0^M
 ^M
 " -i "https://cdn3.onlyfans.com/dash/files/9/9c/9[..]9.mpd" -codec copy "/home/xxx/[..]/0h[..]99_source.mp4"

and this of course also results in the same error like above when manually called via bash terminal:

ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: 
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
Unrecognized option 'cenc_decryption_key'.
Error splitting the argument list: Option not found

Any ideas? String manipulation different from Windows handling?

peddanet commented 7 months ago

As I did not examine the whole source code: BTW how do I enabling verbose debug prints to the console instead of the log file? Why is a Log.Info category missing ?

peddanet commented 7 months ago

Ok, I found now out that this option is only available with gyan.dev builds of ffmpeg. I overread this in the requitrements cause Ithought I had this package already in Ubuntu, but not from gyan.dev!! Now I am looking for the github project to rebuild the source for linux...if this is the case I will close this issue...

peddanet commented 7 months ago

I have rebuild the FFmpeg (watch the capital letter as a difference ;-)) project gyan.dev in version n6.1.1 from github. Then I found out that the option cenc_decryption_key is provided without the dash (-) before. Simply running it from command shell gives the deviating result, no "splitting error" anymore. It is documented like this in FFmpeg/doc/ffmpeg-all.html.

Now I got subsequent errors:

Downloading 5 Paid Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20%s:line 1004
                                                                         ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: 
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled.
[in#0 @ 0x56290cc7e9c0] Error opening input: Protocol not found
[in#0 @ 0x56290cc7e9c0] Did you mean file:https://cdn3.onlyfans.com/dash/files/8/88/88e[..]30.mpd?
Error opening input file [..]e30.mpd.
Error opening input files: Protocol not found
Exception caught: Could not find file '~/of/da[..]30_source.mp4'.

StackTrace:    at System.IO.FileInfo.get_Length()
   at OF_DL.Helpers.DownloadHelper.DownloadDrmMedia(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String folder, DateTime lastModified, Int64 media_id, ProgressTask task, String customFileName, String filename, String path, Boolean showScrapeSize) in ~/Projects/OF_DL_1.7.48/OF DL/Helpers/DownloadHelper.cs:line 628
   at OF_DL.Helpers.DownloadHelper.DownloadPurchasedMessageDRMVideo(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String                                                                          filenameFormat, List messageInfo, Medium messageMedia, FromUser fromUser, Dictionary`2 users, Config config, Boolean showScrapeSiz

So I reconfigured and recompiled FFmpeg to have openssl included to support https protocol: $ ./configure --enable-openssl

but this results in error:

Downloading 5 Paid Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20%
                                                                         [in#0 @ 0x558e6a4b69c0] Error opening input: Invalid data found when processing input
Error opening input file https://cdn3.onlyfans.com/dash/files/5/58/580bf[..]rga.mpd.
Error opening input files: Invalid data found when processing input
Exception caught: Could not find file '~/of/da[..]a_source.mp4'.

StackTrace:    at System.IO.FileInfo.get_Length()
   at OF_DL.Helpers.DownloadHelper.DownloadDrmMedia(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String folder, DateTime lastModified, Int64 media_id, ProgressTask task, String customFileName, String filename, String path, Boolean showScrapeSize) in /home/peddanet/Projects/OF_DL_1.7.48/OF DL/Helpers/DownloadHelper.cs:line 628
   at OF_DL.Helpers.DownloadHelper.DownloadPurchasedMessageDRMVideo(String ffmpegpath, String user_agent, String policy, String signature, String kvp, String sess, String url, String decryptionKey, String                                                                          filenameFormat, List messageInfo, Medium messageMedia, FromUser fromUser, Dictionary`2 users, Config config, Boolean showScrapeSiz
peddanet commented 7 months ago

Can nobody help, please? Did I something wrong?

Where is the project or source code supporting cenc_decryption_key which is obviously used gyan.dev for windows builds?? In the official sources I only find hints for that option in the libavformat/dashdec.c, but no calling arg from command line!

Which option else did you choose to configure when building ffmpeg? How did this DRM run?

I followed this guide configuring and building dependencies:

So I configured ffmpeg with:

$ ./configure --enable-openssl --extra-libs="-lpthread -lm"   --ld="g++"   --enable-gpl   --enable-libaom   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libsvtav1   --enable-libdav1d   --enable-libvorbis   --enable-libvpx   --enable-libx264   --enable-libx265 --enable-nonfree 
$ make
$ make install
whimsical-c4lic0 commented 7 months ago

@peddanet I found that I needed to use the latest version of ffmpeg. Ubuntu and most linux distros ship a much older version of ffmpeg in their default package repositories. If you check the open PRs, I've written a working Dockerfile you can either use directly or as a reference for the required dependencies.

peddanet commented 7 months ago

I

@peddanet I found that I needed to use the latest version of ffmpeg. Ubuntu and most linux distros ship a much older version of ffmpeg in their default package repositories. If you check the open PRs, I've written a working Dockerfile you can either use directly or as a reference for the required dependencies.

@whimsical-c4lic0 ,Thanks for your comment and sharing your experiences! I did now successfully finally it by building ffmpeg myself with every possible feature, which was either available from github or the ubuntu apt repositories: ffmpeg_configure_enable_all.txt So my complete build process which lasts a shift installing all dependencies (package manager or cmake, ninja,make, make install if no apt packages available(mainly source github):

$ git clone https://github.com/FFmpeg/FFmpeg.git
$ cd FFmpeg/
$ git status => master!
# this was the most actual commit when I compiled
$ git checkout 5e2b0862eb1d408625232b37b7a2420403cd498f
$ ./configure $(cat ../ffmpeg_configure_enable_all.txt)

ffmpeg_configure_output.txt

$ make
$ sudo 
make install

Now it works, don't have a clue what dependencies are needed, but now it works perfectly without any change to the source code of this project! I can close the case, I guess!!!!

peddanet commented 7 months ago

Test with this build successfully tested! Thanks for the audience.