Results 1 to 12 of 12
  1. #1
    tsbarath is offline Member
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Watermarking process in java

    I need help in understanding a code. Its related to watermarking concept. My doubt is how to embed a message/a set of bytes into a video file . I mean after converting the video file into byte array.

    The video file must be working after the embedding process.
    If u can help me please do reply.

    If needed I am ready to send the code.

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    The basic concept is to embed the watermark in the least significant bits of the video data. There are lots of ways of doing this, including different places and different encoding schemes, affecting how much the video will change and how resistant the watermark is to video editing.
    A typical way is to use Huffman coding to add the watermark repeatedly in the lowers bits of the chroma values of every I frame (in MPEG video).

  3. #3
    tsbarath is offline Member
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Re:WaterMarking

    This is the major coding part in embeding a message behind a video.

    I cant understand what they have did here.....

    --------->Related to Video file

    String fileName= masterFile.getName();
    masterExtension= fileName.substring(fileName.length()-3, fileName.length());

    if(masterExtension.equalsIgnoreCase("jpg"))
    {
    // Skip past OFFSET_JPG bytes
    byteOut.write(byteArrayIn, 0, OFFSET_JPG);
    inputOutputMarker= OFFSET_JPG;
    }
    else if(masterExtension.equalsIgnoreCase("png"))
    {
    // Skip past OFFSET_PNG bytes
    byteOut.write(byteArrayIn, 0, OFFSET_PNG);
    inputOutputMarker= OFFSET_PNG;
    }
    else
    {
    // Skip past OFFSET_JPG_BMP_TIF bytes
    byteOut.write(byteArrayIn, 0, OFFSET_GIF_BMP_TIF);
    inputOutputMarker= OFFSET_GIF_BMP_TIF;
    }

    // Convert the 32 bit input file size into byte array
    byte tempByte[]= new byte[4];
    for(i=24, j=0; i>=0; i-=8, j++)
    {
    tempInt= inputFileSize;
    tempInt>>= i;
    tempInt&= 0x000000FF;
    tempByte[j]= (byte) tempInt;
    }
    // Embed 4 byte input File size array into the master file
    embedBytes(tempByte);

    // Write the remaining bytes
    byteOut.write(byteArrayIn, inputOutputMarker, inputFileSize- inputOutputMarker);
    inputOutputMarker= inputFileSize;

    // Embed the 3 byte version information into the file
    writeBytes(VERSION_BYTE);

    // Write 1 byte for features
    writeBytes(new byte[]{features});

    // Embed 1 byte compression ratio into the output file
    writeBytes(new byte[]{(byte) compressionRatio});





    -------->Related to Message

    // Convery the 32 bit message size into byte array
    tempByte= new byte[4];
    for(i=24, j=0; i>=0; i-=8, j++)
    {
    tempInt= messageSize;
    tempInt>>= i;
    tempInt&= 0x000000FF;
    tempByte[j]= (byte) tempInt;
    }
    // Embed 4 byte messageSize array into the master file
    writeBytes(tempByte);

    // Embed the message
    writeBytes(messageArray);

    If you need the coding please tell me i will send u the coding to ur mail... My mail id is tsbarath->gmail

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    It appears to be a program to watermark images, not video. It is very simple, only adding the message once, at a point OFFSET_XXX into the file, along with messageSize and compressionRatio.
    The way it embeds the message is contained in embedBytes(), which you have not provided.

  5. #5
    tsbarath is offline Member
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Re:WaterMarking

    Ya thats wat i dont understand ...
    It looks like watermarking pictures but when i run those file, I am able to watermark a video file.. can i have ur mail id to send u the full file.

  6. #6
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Well, as long as the process to create the byte array from the file, it will be able to watermark any file that will survive low-bits being changed, as long as it lands in the right place. It would be a pretty rubbish video watermark, and apparently a pretty rubbish image watermarker too.

    I don't want to give out my email, but if you upload it to the internet and give the link then I'll look at it (and others here will be able to as well).

  7. #7
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default Watermarking in java class file

    Hi

    I would like to know how to embed watermark in Java class file and decode that watermark class file to get back the watermark value.

    I will be appreciate if any one can provide the source code.

    I'hv tried many time to get the bytecode of the class file to embed the watermark value but failed. Should i used the class reader to read the class file but where i must to called the class file and how.

    I include some code that i don't know where to get my .class inside this code:

    package test;

    import javax.swing.JOptionPane;

    public class ClassLocationTest {
    public static void main(String[] args) {
    JOptionPane.showMessageDialog(null, getClassLocation(String.class));
    }

    public static String getClassLocation(final Class<?> pClass) {
    final String location, name;
    name = pClass.getName().replaceAll("\\.", "/") + ".class";
    location = ClassLoader.getSystemResource(name).getPath();
    return location;
    }
    }



    I hope any one can help me immediately because i must to submit it next week.



    Thanks you
    Azura

  8. #8
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    1. Please don't hi-jack other people's threads
    2. Please use [code] tags when posting code
    3. Watermarking is used to encode data in files that have high tolerance for corrupted bits. A Java class file is not one of them. You might be able to add Annotations, or obfuscate some code, but steganograpic techniques are not possible.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  9. #9
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default

    i notice that we can embed watermark in attribute from the class file that we choose.

  10. #10
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Not sure what you mean by "watermark" or "attribute" in this context.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  11. #11
    Bhaumik is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Audio Steganography

    Hey Frds...Will you please help me in my audio Steganography Project. i have some doubt in following coding.

    // Convert the 32 bit input file size into byte array
    byte tempByte[]= new byte[4];
    for(i=24, j=0; i>=0; i-=8, j++)
    {
    tempInt= inputFileSize;
    tempInt>>= i;//tempInt=tempInt>>i;
    tempInt&= 0x000000FF;
    tempByte[j]= (byte) tempInt;
    }

    Why and How to Convert 32 bit input file size into byte array....?

    Will anyone explain me this coding?

    Please I have a Project Submission on Monday(09/5/2011).

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Please do not hijack another's thread with your question. Go to the correct forum, click on the "New Thread" button and create your new question. I'm locking this thread and will delete your post and mine in a few.

Similar Threads

  1. How to find OS Process List in JAVA ?
    By abstrusevaibhav in forum New To Java
    Replies: 0
    Last Post: 01-29-2009, 11:08 AM
  2. Replies: 2
    Last Post: 01-06-2009, 04:53 PM
  3. killing a java process
    By paritoshcg in forum Advanced Java
    Replies: 3
    Last Post: 12-01-2008, 09:16 AM
  4. Replies: 1
    Last Post: 08-03-2007, 07:17 PM
  5. Linux process from java
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 06:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •