#9777 closed defect (fixed)
-decryption_key does not work
| Reported by: | svnpenn | Owned by: | Shuangxi,Li |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | unspecified | Keywords: | |
| Cc: | Shuangxi,Li | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by )
Using a command like this fails:
PS D:\Desktop> ffmpeg -decryption_key 13d7c7cf295444944b627ef0ad2c1b3c -i infile.mp4 -c copy outfile.mp4
ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001fce0e5b240] leftover packet bytes after subsample processing
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001fce0e5b240] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 384x216, 145 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'infile.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1dash
creation_time : 2022-04-01T12:13:24.000000Z
Duration: 01:39:24.46, bitrate: 156 kb/s
Stream #0:0[0x1](und): Video: h264 (avc1 / 0x31637661), none, 384x216, 145 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 24k tbr, 24k tbn (default)
Metadata:
creation_time : 2022-04-01T12:13:24.000000Z
handler_name : ETI ISO Video Media Handler
vendor_id : [0][0][0][0]
encoder : Elemental H.264
Side data:
unknown side data type 24 (2088984 bytes)
Output #0, mp4, to 'outfile.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1dash
encoder : Lavf59.16.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 384x216 [SAR 1:1 DAR 16:9], q=2-31, 145 kb/s, 23.98 fps, 24k tbr, 24k tbn (default)
Metadata:
creation_time : 2022-04-01T12:13:24.000000Z
handler_name : ETI ISO Video Media Handler
vendor_id : [0][0][0][0]
encoder : Elemental H.264
Side data:
unknown side data type 24 (2088984 bytes)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001fce0e5b240] leftover packet bytes after subsample processing
infile.mp4: Invalid data found when processing input
Input file is about 100 MB, output file is 262 bytes. Same command with mp4decrypt works:
mp4decrypt --key 28339ad78f734520da24e6e0573d392e:13d7c7cf295444944b627ef0ad2c1b3c infile.mp4 outfile.mp4
I can upload the input file if need be.
Change History (5)
comment:1 by , 4 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 4 years ago
I can upload the input file if need be.
Please!
mp4decrypt
Are you sure mp4decrypt will work without init.mp4? I very much doubt that.
Contrast with other tools, which can decrypt the whole file at once.
I think we have a policy that we usually do not open other files needed and that are supposed to be in the same folder. If init.mp4 is always needed...
comment:3 by , 4 years ago
| Cc: | added |
|---|---|
| Component: | undetermined → avformat |
| Owner: | set to |
| Status: | new → open |
The CENC decryption function has a bug, In the funciton cenc_scheme_decrypt,Partially_encrypted_block_size may be a negative value. Therefore, a core dump occurs when memcpy(block, partially_encrypted_block, partially_encrypted_block_size); is executed.
comment:4 by , 4 years ago
| Resolution: | → fixed |
|---|---|
| Status: | open → closed |



I found the answer here:
https://stackoverflow.com/questions/66029486/decrypting-fragmented-mpeg-dash-using-ffmpeg
It seems currently with FFmpeg, you must decrypt each fragment separately, and you must combine the init segment with each fragment before decrypting. Contrast with other tools, which can decrypt the whole file at once.