Class VideoSteg

  • All Implemented Interfaces:
    Steganography

    public class VideoSteg
    extends java.lang.Object
    implements Steganography
    Since:
    : 23-11-2020
    Author:
    : Enrico Gamil Toros de Chadarevian Project name : ProjektStudiumSteganography
    • Constructor Summary

      Constructors 
      Constructor Description
      VideoSteg()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decode​(byte[] steganographicData)
      Extract the hidden Payload from a Steganographic Video
      byte[] decode​(byte[] steganographicData, long seed)
      Extract the hidden Payload from a Steganographic Video using a custom seed
      byte[] encode​(byte[] carrier, byte[] payload)
      Use setMaxEncodingThreads(int) and setMaxDecodingThreads(int) to enable multithreading (by default single threaded).
      byte[] encode​(byte[] carrier, byte[] payload, long seed)
      Use setMaxEncodingThreads(int) and setMaxDecodingThreads(int) to enable multithreading (by default single threaded).
      java.io.File getFfmpegBin()
      Get path of ffmpeg bin
      long getVideoCapacity​(byte[] carrier)
      Returns the maximum number of bytes that can be encoded in the given video.
      long getVideoCapacity​(java.util.List<byte[]> pictureList)
      Returns the maximum number of bytes that can be encoded in the given video.
      boolean isSteganographicData​(byte[] data)
      Tests whether the given data has a hidden message encoded in it.
      boolean isSteganographicData​(byte[] data, long seed)
      Tests whether the given data has a hidden message encoded in it.
      void setDebug​(boolean debug)  
      void setFfmpegBin​(java.io.File ffmpegBin)
      If another version or a different distribution of ffmpeg or ffprobe should be used you can set the File path here.
      void setMaxDecodingThreads​(int maxDecodingThreads)
      Set the number of threads used to decode the pictures WARNING very memory expensive might overflow max JVM heap VM option: -Xmx might help By default using 1 Threads To use multithreading set maxDecodingThreads higher than 1
      void setMaxEncodingThreads​(int maxEncodingThreads)
      Set the number of threads used to encode the pictures WARNING very memory expensive might overflow max JVM heap VM option: -Xmx might help By default using 1 Threads To use multithreading set maxEncodingThreads higher than 1
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VideoSteg

        public VideoSteg()
    • Method Detail

      • decode

        public byte[] decode​(byte[] steganographicData,
                             long seed)
                      throws java.io.IOException,
                             VideoNotFoundException,
                             UnsupportedVideoTypeException
        Extract the hidden Payload from a Steganographic Video using a custom seed
        Specified by:
        decode in interface Steganography
        Parameters:
        steganographicData - Media containing the hidden message to decode
        seed - seed that was used to encode the given stenographicData
        Returns:
        the hidden message as a byte array
        Throws:
        java.io.IOException - if a problem occurs during reading of steganographicData
        VideoNotFoundException
        UnsupportedVideoTypeException
      • isSteganographicData

        public boolean isSteganographicData​(byte[] data)
                                     throws java.io.IOException,
                                            UnsupportedMediaTypeException,
                                            MediaNotFoundException
        Description copied from interface: Steganography

        Tests whether the given data has a hidden message encoded in it. This method only works if the message was encoded using the given Seed or the respective default Seed. Otherwise it will always return false.

        The use of this method is discouraged. It saves very little resources compared to decode(...). So unless you need to test a lot of possible steganographicData, just use decode(...) and catch the UnknownStegFormatException

        Specified by:
        isSteganographicData in interface Steganography
        Parameters:
        data - data to test
        Returns:
        true if the given data has a hidden message encoded in it
        Throws:
        java.io.IOException - if a problem occurs during reading of data
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from data
      • isSteganographicData

        public boolean isSteganographicData​(byte[] data,
                                            long seed)
                                     throws java.io.IOException,
                                            MediaNotFoundException,
                                            UnsupportedMediaTypeException
        Description copied from interface: Steganography

        Tests whether the given data has a hidden message encoded in it. This method only works if the message was encoded using the given Seed. Otherwise it will always return false.

        The use of this method is discouraged. It saves very little resources compared to decode(...). So unless you need to test a lot of possible steganographicData, just use decode(...) and catch the UnknownStegFormatException

        Specified by:
        isSteganographicData in interface Steganography
        Parameters:
        data - data to test
        seed - seed the hidden message was encoded with
        Returns:
        true if the given data has a hidden message encoded in it
        Throws:
        java.io.IOException - if a problem occurs during reading of data
        MediaNotFoundException - if the intended media (e.g. Image, Video, ...) could not be read from data
        UnsupportedMediaTypeException - if the Media Type (e.g. JPG) is not supported
      • setMaxEncodingThreads

        public void setMaxEncodingThreads​(int maxEncodingThreads)
        Set the number of threads used to encode the pictures WARNING very memory expensive might overflow max JVM heap VM option: -Xmx might help By default using 1 Threads To use multithreading set maxEncodingThreads higher than 1
        Parameters:
        maxEncodingThreads - max number of Threads used to encode
      • setMaxDecodingThreads

        public void setMaxDecodingThreads​(int maxDecodingThreads)
        Set the number of threads used to decode the pictures WARNING very memory expensive might overflow max JVM heap VM option: -Xmx might help By default using 1 Threads To use multithreading set maxDecodingThreads higher than 1
        Parameters:
        maxDecodingThreads - max number of Threads used to decode
      • setDebug

        public void setDebug​(boolean debug)
      • getVideoCapacity

        public long getVideoCapacity​(java.util.List<byte[]> pictureList)
                              throws java.io.IOException,
                                     NoImageException,
                                     UnsupportedImageTypeException
        Returns the maximum number of bytes that can be encoded in the given video.
        Parameters:
        pictureList - list of pictures that will be encoded
        Returns:
        max amount of total number of bytes that can be encoded in the carrier
        Throws:
        java.io.IOException - if IO Exception occurs
        NoImageException - Thrown if the attempt to read an image failed.
        UnsupportedImageTypeException - Thrown if an operation was attempted on an image type it doesn't support.
      • setFfmpegBin

        public void setFfmpegBin​(java.io.File ffmpegBin)
        If another version or a different distribution of ffmpeg or ffprobe should be used you can set the File path here.
        Parameters:
        ffmpegBin - File pointing the Path of ffmpeg and ffprobe
      • getFfmpegBin

        public java.io.File getFfmpegBin()
        Get path of ffmpeg bin
        Returns:
        File where ffmpeg is searched