devine-dl / devine

Modular Movie, TV, and Music Archival Software
GNU General Public License v3.0
313 stars 73 forks source link

Shaka-Packager decryption failure on mp4a, exit code -11 #86

Open Sp5rky opened 3 months ago

Sp5rky commented 3 months ago

Describe the bug When running on Gentoo or Ubuntu I get this error Process exit code: -11

Always seem to happen right after the subtitles are downloaded, when checking the /tmp folder I see Video get merged correctly but after the Audio merges the tmp file vanishes when the subtitles download and the video does not contain audio.

Sometimes if I'm fast enough before the subtitles download I can grab both video and audio decrypted correctly.

To Reproduce I believe I'm just missing extra steps, but I was able to reproduce this on Gentoo and Ubuntu headless servers, building shaka-packager from source and getting ffmpeg/MKVToolNix and ccextractor from prebuilt binaries.

devine installed via Poetry install and all files in correct $PATH

Oddly, no additional output from python is show with this error for a trace so it's been tricky for me to pin-point on my own.

Screenshots

                   / __ \/ ____/ |  / /  _/ | / / ____/                     
                  / / / / __/  | | / // //  |/ / __/                        
                 / /_/ / /___  | |/ // // /|  / /___                        
                /_____/_____/  |___/___/_/ |_/_____/                        
                ⠀                                                           
                v3.0.0 Copyright © 2019-2024 rlaphoenix                     
                  https://github.com/devine-dl/devine                       

 Service Config loaded                                                      
 Loaded Cdm Widevine CDM: x (L3)                                         
 Loaded 0 Vaults                                                            

────────────────────────────── Service: x ──────────────────────────────

 Service has no Geofence                                                    
 Authenticated with Service                                                 

────────────────────────────── Series: x ───────────────────────────────

 x                                                     

──────────────────────── x S01E01 ────────────────────────────────────

 Cached 1 Key to 0/0 Vaults                                                 

 [Widevine]: I0323 23:03:37.138360    9602 demuxer.cc:94]                   
             Demuxer::Run() on file '/tmp/devine/Video_cb1d2248.mp4'.       
             I0323 23:03:37.138396    9602 demuxer.cc:160] Initialize       
             Demuxer for file '/tmp/devine/Video_cb1d2248.mp4'. I0323       
             23:03:37.633686    9602 single_segment_segmenter.cc:111]       
             Update media header (moov) and rewrite the file to             
             '/tmp/devine/Video_cb1d2248_decrypted.mp4'. I0323              
             23:03:37.788710    9602 mp4_muxer.cc:193] MP4 file             
             '/tmp/devine/Video_cb1d2248_decrypted.mp4' finalized.          
 Cached 1 Key to 0/0 Vaults                                                 

 [Widevine]: I0323 23:03:40.349510    9609 demuxer.cc:94]                   
             Demuxer::Run() on file '/tmp/devine/Audio_2f4bf1f5.mp4'.       
             I0323 23:03:40.349552    9609 demuxer.cc:160] Initialize       
             Demuxer for file '/tmp/devine/Audio_2f4bf1f5.mp4'.             

 1 Video                                                                    
 └── [H.264, SDR] | ko | 1920x1080 @ 2526 kb/s, 30.000 FPS                  
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • 00:09 • Downloaded         
 1 Audio                                                                    
 └── [AAC] | 2.0 | 200 kb/s | ko                                            
     ⠇ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • --:-- • Decrypting        
 3 Subtitles                                                                
 ├── [VTT] | en                                                             
 │    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • 00:12 • Downloaded         
 ├── [VTT] | es                                                             
 │    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • 00:13 • Downloaded         
 └── [VTT] | pt                                                             
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • 00:13 • Downloaded         

 Widevine(x)                   
 └── x:x*     

 ❌ Download Failed...                                                      
    One of the download workers had an error!                               
    See the error trace above for more information.                         
    Process exit code: -11 

image

rlaphoenix commented 3 months ago

This error actually seems to be a decryption error on the Audio file, even though it looks as if it isn't. I say this because if the audio did decrypt successfully it wouldn't have logged shaka-packager's output but would have also marked the track as Decrypted right after, you can see it errored at some point right as it was decrypting.

I would need to test more things personally with you to really see what's going on here, perhaps you could join the Discord (button in README) and PM me.

rlaphoenix commented 3 months ago

After discussing this issue on Discord and through AnyDesk it was discovered to be a fault with Shaka-Packager v3.x having a segmentation fault.

I0324 18:50:19.184362   15732 demuxer.cc:94] Demuxer::Run() on file '/tmp/devine/Audio_2f4bf1f5.mp4'.
I0324 18:50:19.184499   15732 demuxer.cc:160] Initialize Demuxer for file '/tmp/devine/Audio_2f4bf1f5.mp4'.
Segmentation fault (core dumped)

Using --dump_stream_info alone succeeds, but when in the same call would also result in a Segmentation fault:

I0324 18:44:34.674327   15661 demuxer.cc:94] Demuxer::Run() on file '/tmp/devine/Audio_2f4bf1f5.mp4'.
I0324 18:44:34.674452   15661 demuxer.cc:160] Initialize Demuxer for file '/tmp/devine/Audio_2f4bf1f5.mp4'.

File "/tmp/devine/Audio_2f4bf1f5.mp4":
Found 1 stream(s).
Stream [0] type: Audio
 codec_string: mp4a.40.2
 time_scale: 48000
 duration: 84737472 (1765.4 seconds)
 is_encrypted: false
 codec: AAC
 sample_bits: 16
 num_channels: 2
 sampling_frequency: 48000
 language: kor

Segmentation fault (core dumped)

This could be a linux-only issue, and seemingly specific to mp4a. If you also have this issue please let me know. A workaround for now is to downgrade packager to v2.6.1.