Removing encryption information such as the pssh (Protection System Specific Header) box from a DASH stream's initialization segment or media segments can be useful in certain scenarios, like analyzing content or preparing files for playback without DRM restrictions. However, it’s important to note that removing encryption data does not remove DRM protection — it just removes metadata related to it.
This guide will show you how to remove the pssh box (or other encryption-related boxes) from MP4-based DASH streams using tools like mp4box, ffmpeg, and hex editors or custom scripts if needed.
🔍 Understanding the PSSH Box
The pssh box is part of the ISO Base Media File Format (ISO/IEC 14496-12), used in DASH and HLS to carry DRM system-specific data. It typically appears in the initialization segment and sometimes in each media segment.
You can identify it by its type: 'pssh'.
✅ Tools You Can Use
1. MP4Box (from GPAC)
MP4Box is a powerful tool for manipulating MP4 files.
To inspect the structure of an MP4 file:
MP4Box -info input_init.mp4
To remove the pssh box:
MP4Box doesn't directly support removing specific boxes, but you can use -add to rebuild the file without copying the pssh:
# Re-add the track without copying the original boxes
MP4Box -add input_init.mp4#video -new output_init.mp4
Depending on how the file was structured, this may drop the pssh box.
If you need more control, you can extract all atoms except the pssh:
MP4Box -raw 1 -out temp.h264 input_init.mp4
MP4Box -add temp.h264 -new clean_init.mp4
This method strips all metadata, including encryption info.
2. FFmpeg
FFmpeg can transcode or repackage media, which effectively removes encryption info.
Example:
ffmpeg -i input_init.mp4 -c copy -movflags +faststart clean_init.mp4
However, if there is actual encryption (like CENC or AES), FFmpeg won't decode it unless you provide decryption keys. But for removing the pssh box itself, transcoding works:
ffmpeg -i input_init.mp4 -c:v copy -an -bsf:v filter_units=remove_types=8 clean_init.mp4
Note: This approach may not always remove pssh unless you force a full re-encode or re-muxing.
For full removal:
ffmpeg -i input_init.mp4 -c copy -map 0 -ignore_unknown -f mp4 clean_init.mp4
3. Hex Editor (Manual Approach)
If you want to precisely remove the pssh box manually:
- Open the MP4 file in a hex editor (e.g., HxD, Hex Fiend).
- Locate the
pssh box. Look for ASCII bytes p s s h.
- The first 4 bytes before that indicate the length of the box.
- Delete the entire box (
length + 'pssh' + data).
- Save the modified file.
⚠️ Be very careful — modifying binary files manually can corrupt them.
4. Custom Scripts / Libraries
Use libraries like isobmff or Python with pymp4parse or bxtpy to parse and edit MP4 boxes.
Example in Python (simplified):
from bxtpy import BoxUtil
boxes = BoxUtil.parse_file("input_init.mp4")
filtered_boxes = [b for b in boxes if b.type != "pssh"]
BoxUtil.write_boxes(filtered_boxes, "clean_init.mp4")
Or use mp4file from this library.
📌 Summary
| Method | Removes pssh? | Preserves Quality | Notes |
|---|
| MP4Box | ✅ | ✅ | May require re-adding tracks |
| FFmpeg | ✅ (if re-encoded) | ❌ (with re-encode) | Easy, but lossy if not careful |
| Hex Editor | ✅ | ✅ | Risky; manual work |
| Custom Code | ✅ | ✅ | Requires dev skills |
⚠️ Legal & Ethical Considerations
Be aware that:
- Removing encryption information does not mean bypassing DRM.
- Attempting to circumvent DRM protections may violate laws like the DMCA.
- Only perform these actions on content you own or have permission to modify.
Let me know if you'd like a script to automate this or help with a specific file!