Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

I am trying to encrypt and dash an audio stream packaged in mp4 container using gpac. However, the segments produced by gpac contains corrupted isobmff boxes. 
Encryption type used: cenc (common encryption) with the DRM.xml file containing key and kid pair. 
The gpac command used to generate the mpd and the segments is:
gpac -i ass1-cenc-1.mp4:FID=A1  cecrypt:cfile=DRM.xml:SID=A1:FID=A2 -o stream.mpd:profile=live:muxtype=mp4:segdur=2:cdur=2:cmaf=cmfc:tpl:stl:template="$File$-Seg-$Number$":SID=A2
The isobmff boxes in the initialisation segments seems fine. However, following issues are seen with the segments:
•	segments don’t contain a proper styp box at the beginning. 
•	Decoders can’t read the segments if the styp box is corrupted. 
•	On patching styp box some other boxes like senc still show corruption.
GPAC version used: version 1.1.0-DEV-rev1540-g6eb2032c-master

Corrupted segments when encrypting mp4 containing audio stream using gpac
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Corrupted segments when encrypting mp4 containing audio stream using gpac
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

I am trying to encrypt and dash an audio stream packaged in mp4 container using gpac. However, the segments produced by gpac contains corrupted isobmff boxes. 
Encryption type used: cenc (common encryption) with the DRM.xml file containing key and kid pair. 
The gpac command used to generate the mpd and the segments is:
gpac -i ass1-cenc-1.mp4:FID=A1  cecrypt:cfile=DRM.xml:SID=A1:FID=A2 -o stream.mpd:profile=live:muxtype=mp4:segdur=2:cdur=2:cmaf=cmfc:tpl:stl:template="$File$-Seg-$Number$":SID=A2
The isobmff boxes in the initialisation segments seems fine. However, following issues are seen with the segments:
•	segments don’t contain a proper styp box at the beginning. 
•	Decoders can’t read the segments if the styp box is corrupted. 
•	On patching styp box some other boxes like senc still show corruption.
GPAC version used: version 1.1.0-DEV-rev1540-g6eb2032c-master

--- end body ---
