@@ -0,0 +1,2211 @@
+package com.googlecode.mp4parser;%0A%0Aimport com.coremedia.iso.boxes.Container;%0Aimport com.googlecode.mp4parser.authoring.Movie;%0Aimport com.googlecode.mp4parser.authoring.Track;%0Aimport com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;%0Aimport com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;%0Aimport com.googlecode.mp4parser.authoring.tracks.CencDecryptingTrackImpl;%0Aimport com.googlecode.mp4parser.authoring.tracks.CencEncryptingTrackImpl;%0Aimport com.googlecode.mp4parser.authoring.tracks.CencEncyprtedTrack;%0A%0Aimport javax.crypto.SecretKey;%0Aimport javax.crypto.spec.SecretKeySpec;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.nio.channels.Channels;%0Aimport java.util.UUID;%0A%0A/**%0A * Created by user on 22.07.2014.%0A */%0Apublic class CencEncryptDecrypt %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        DefaultMp4Builder mp4Builder = new DefaultMp4Builder();%0A%0A        Movie mOrig = MovieCreator.build(CencEncryptDecrypt.class.getProtectionDomain().getCodeSource().getLocation().getFile() + %22/1365070268951.mp4%22);%0A%0A        Movie mEncryptOut = new Movie();%0A        SecretKey sk = new SecretKeySpec(new byte%5B%5D%7B0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0%7D, %22AES%22);%0A        for (Track track : mOrig.getTracks()) %7B%0A            mEncryptOut.addTrack(new CencEncryptingTrackImpl(track, UUID.randomUUID(), sk));%0A        %7D%0A%0A        Container cEncrypted = mp4Builder.build(mEncryptOut);%0A        ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A        cEncrypted.writeContainer(Channels.newChannel(baos));%0A%0A        Movie mEncryptIn = MovieCreator.build (new MemoryDataSourceImpl(baos.toByteArray()));%0A        Movie mDecrypt = new Movie();%0A%0A        for (Track track : mEncryptIn.getTracks()) %7B%0A            if (track instanceof CencEncyprtedTrack) %7B%0A                mDecrypt.addTrack(new CencDecryptingTrackImpl((CencEncyprtedTrack) track, sk));%0A            %7D else %7B%0A                mDecrypt.addTrack(track);%0A            %7D%0A        %7D%0A%0A        Container cDecrypted = mp4Builder.build(mDecrypt);%0A        FileOutputStream fos = new FileOutputStream(%22output.mp4%22);%0A        cDecrypted.writeContainer(fos.getChannel());%0A%0A    %7D%0A%7D%0A

encrypt decrypt example