shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
1.97k stars 507 forks source link

'Failed to read slice header' when enable_raw_key_encryption #1094

Closed yjacket closed 5 months ago

yjacket commented 2 years ago

System info

Operating System: Windows 10 (19042.1083) Shaka Packager Version: v2.6.1-634af65-release

Issue and steps to reproduce the problem

Packager Command:

packager-win in=test.mp4,stream=video,init_segment=output/video0.m4s,segment_template=output/video$Number$.m4s,drm_label=VIDEO  --enable_raw_key_encryption --keys key_id=3149de1c21ccd724c9f27801f95743b0:key=b900c4b85b3ad5ba85fd518106066e75 --mpd_output  output\playlist.mpd

Extra steps to reproduce the problem?

Nothing

What is the expected result?

Packaging completed successfully.

What happens instead?

[0901/160746:INFO:demuxer.cc(89)] Demuxer::Run() on file 'test.mp4'.
[0901/160746:INFO:demuxer.cc(155)] Initialize Demuxer for file 'test.mp4'.
[0901/160746:WARNING:avc_decoder_configuration_record.cc(91)] Insufficient bits in bitstream for given AVC profile
[0901/160746:WARNING:avc_decoder_configuration_record.cc(91)] Insufficient bits in bitstream for given AVC profile
[0901/160746:ERROR:subsample_generator.cc(326)] Failed to read slice header.
[0901/160746:ERROR:demuxer.cc(356)] Failed to process sample 256 9 (ENCRYPTION_FAILURE): Failed to read slice header.
[0901/160746:ERROR:mp4_media_parser.cc(889)] Failed to process the sample.
[0901/160746:ERROR:packager_main.cc(554)] Packaging Error: 8 (PARSER_FAILURE): Cannot parse media file test.mp4

ffmpeg error log

ffmpeg -v error -i test.mp4 -f null - 2>error.log

[h264 @ 06895b00] slice type 32 too large at -1
[h264 @ 06895b00] decode_slice_header error
[h264 @ 04ad9200] slice type 32 too large at -1
[h264 @ 04ad9200] decode_slice_header error
[h264 @ 06894f40] sps_id 32 out of range
    Last message repeated 2 times
[h264 @ 049fa980] slice type 32 too large at -1
[h264 @ 049fa980] decode_slice_header error
[h264 @ 049b79c0] slice type 32 too large at -1
[h264 @ 049b79c0] decode_slice_header error
[h264 @ 049f7cc0] slice type 32 too large at -1
[h264 @ 049f7cc0] decode_slice_header error
[h264 @ 049fa0c0] slice type 32 too large at -1
[h264 @ 049fa0c0] decode_slice_header error
[h264 @ 06895b00] slice type 32 too large at -1
[h264 @ 06895b00] decode_slice_header error
[null @ 049fb580] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 19902 >= 19902
[h264 @ 049fa980] slice type 32 too large at -1
[h264 @ 049fa980] decode_slice_header error
[h264 @ 06895b00] slice type 32 too large at -1
[h264 @ 06895b00] decode_slice_header error

Attached sample video is a part of the last 1 min. But it has same issue like the original one.

https://user-images.githubusercontent.com/3658595/187856492-ff9484a1-d429-437b-a9aa-242632868c3d.mp4

cosmin commented 5 months ago

The source video (attached) has corruption in the bitstream.

[h264 @ 0x15a94c530] slice type 32 too large at -189
[h264 @ 0x15a94c530] decode_slice_header error
[h264 @ 0x15a921290] slice type 32 too large at -1
[h264 @ 0x15a921290] decode_slice_header error