truedread / pymp4decrypt Goto Github PK
View Code? Open in Web Editor NEWA Python MP4 decrypter for CENC encrypted MP4s
License: GNU General Public License v3.0
A Python MP4 decrypter for CENC encrypted MP4s
License: GNU General Public License v3.0
Audio doesn't have explicit cipher/clear bytes, so the sample sizes are defined in the stsz box. The decrypter needs to be updated to make use of it.
C:\Users\Suporte\Downloads\pymp4decrypt-master\src>python decrypt.py -k 4ce68c303ae037a59888d4866de39ffb -i C:\Users\Suporte\Downloads\pymp4decrypt-master\Blank.mp4 -o C:\Users\Suporte\Downloads\pymp4decrypt-master\Blank2.mp4
Traceback (most recent call last):
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 1089, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 1089, in
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymp4-1.1.0-py3.7.egg\pymp4\parser.py", line 46, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 855, in _parse
AttributeError: 'bytes' object has no attribute 'items'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 2696, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 1093, in _parse
construct.core.RangeError: could not read prefix or enough elements, stream too short?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "decrypt.py", line 131, in
main()
File "decrypt.py", line 50, in main
decrypt(args.key, args.input, args.output)
File "decrypt.py", line 83, in decrypt
box = Box.parse_stream(reader)
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 186, in parse_stream
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymp4-1.1.0-py3.7.egg\pymp4\parser.py", line 46, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 855, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 297, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 1544, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 859, in _parse
File "C:\Users\Suporte\AppData\Local\Programs\Python\Python37-32\lib\site-packages\construct-2.8.8-py3.7.egg\construct\core.py", line 2700, in _parse
construct.core.RangeError: could not read prefix or enough elements, stream too short?
parsing -> entries
too many errors
fix one , comes another one
PIFF encrypted MP4s use UUIDs for box names instead of the normal type names (tenc, senc, pssh), so the decrypter would need to be updated to map each UUID to the box. Fortunately, pymp4 already supports parsing the PIFF boxes (at least on my fork).
"When a 16 byte Per_Sample_IV_Size is indicated and the least significant 8 bytes (64 bit counter) reaches the maximum value (0xFFFFFFFFFFFFFFFF), then incrementing it SHALL reset the 8 byte block counter to zero (bytes 8 to 15) without affecting the other 8 bytes of the counter (bytes 0 to 7)" (ISO/IEC 23001-7:2016).
The decrypter is assuming all IV sizes are set to 8 and is not reading the value for the actual IV size, so something with an IV size of 16 would fail.
suporte@SUP-13:~/pymp4decrypt/src$ python decrypt.py -k 4ce68c303ae037a59888d4866de39ffb -i ~/Blank\ -\ A\ Vinylmation\ Love\ Story-FitJ3hgxiAg.mp4 -o ~/Blank.mp4
Traceback (most recent call last):
File "decrypt.py", line 131, in
main()
File "decrypt.py", line 50, in main
decrypt(args.key, args.input, args.output)
File "decrypt.py", line 78, in decrypt
with BufferedReader(inp) as reader:
AttributeError: 'file' object has no attribute 'readable'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.