Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (21)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Utilisation et configuration du script

    19 janvier 2011, par

    Informations spécifiques à la distribution Debian
    Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
    Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
    Récupération du script
    Le script d’installation peut être récupéré de deux manières différentes.
    Via svn en utilisant la commande pour récupérer le code source à jour :
    svn co (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (5435)

  • How to get video frame for a specific time from mp4

    11 décembre 2015, par man-r

    i have an mp4 video byte array and i need to generate a thumbnail for it using its middle frame (e.g. if the video length is 10 seconds then i need to get the picture from 5th second).

    i managed to parse through the file and extract its boxes (atom). i have also managed to get the video length from the mvhd box. also i managed to extract
    1. the time-To-Sample table from stts box,
    2. the sample-To-Chunk table from stcs box,
    3. the chunk-Offset table from stco box,
    4. the sample Size table from stsz box,
    5. the Sync Sample table from stss box

    i know that all the actual media are available in the mdat box and that i need to correlate the above table to find the exact frame offset in the file but my question is how ? the tables data seems to be compressed (specially the time-To-Sample table) but i don’t know how decompress them.

    any help is appreciated.

    below are code samples

    code to convert byte to hex

    public static char[] bytesToHex(byte[] bytes) {
       char[] hexChars = new char[bytes.length * 2];
       for ( int j = 0; j < bytes.length; j++ ) {
           int v = bytes[j] & 0xFF;

           hexChars[j * 2] = hexArray[v >>> 4];
           hexChars[j * 2 + 1] = hexArray[v & 0x0F];            
       }
       return hexChars;
    }

    code for getting the box offset

    final static String MOOV                          = "6D6F6F76";
    final static String MOOV_MVHD                     = "6D766864";
    final static String MOOV_TRAK                     = "7472616B";
    final static String MOOV_TRAK_MDIA                = "6D646961";
    final static String MOOV_TRAK_MDIA_MINF           = "6D696E66";
    final static String MOOV_TRAK_MDIA_MINF_STBL      = "7374626C";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSD = "73747364";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STTS = "73747473";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSS = "73747373";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSC = "73747363";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STCO = "7374636F";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSZ = "7374737A";

    static int getBox(char[] s, int offset, String type) {
       int typeOffset = -1;
       for (int i = offset*2; i-1) {
                   break;
               }
           }
           i+=(size*2);
       }

       return typeOffset;
    }

    code for getting the duration and timescale

    static int[] getDuration(char[] s) {
       int mvhdOffset = getBox(s, 0, MOOV_MVHD);
       int timeScaleStart = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4)*2;
       int timeScaleEnd   = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;

       int durationStart  = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;
       int durationEnd    = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4 + 4)*2;

       String timeScaleHex = new String(Arrays.copyOfRange(s, timeScaleStart, timeScaleEnd));
       String durationHex = new String(Arrays.copyOfRange(s, durationStart, durationEnd));

       int timeScale = Integer.parseInt(timeScaleHex, 16);
       int duration = Integer.parseInt(durationHex, 16);

       int[] result = {duration, timeScale};
       return result;
    }

    code to get the time-To-Sample table

    static int[][] getTimeToSampleTable(char[] s, int trakOffset) {
       int offset = getBox(s, trakOffset, MOOV_TRAK_MDIA_MINF_STBL_STTS);
       int sizeStart = offset*2;
       int sizeEnd   = offset*2 + (4)*2;

       int typeStart = offset*2 + (4)*2;
       int typeEnd   = offset*2 + (4 + 4)*2;

       int noOfEntriesStart = offset*2 + (4 + 4 + 1 + 3)*2;
       int noOfEntriesEnd   = offset*2 + (4 + 4 + 1 + 3 + 4)*2;

       String sizeHex = new String(Arrays.copyOfRange(s, sizeStart, sizeEnd));
       String typeHex = new String(Arrays.copyOfRange(s, typeStart, typeEnd));
       String noOfEntriesHex = new String(Arrays.copyOfRange(s, noOfEntriesStart, noOfEntriesEnd));

       int size = Integer.parseInt(sizeHex, 16);
       int noOfEntries = Integer.parseInt(noOfEntriesHex, 16);

       int[][] timeToSampleTable = new int[noOfEntries][2];

       for (int i = 0; icode>
  • MP4 file data structure

    16 décembre 2015, par man-r

    i have an mp4 video byte array and i need to generate a thumbnail for it using its middle frame (e.g. if the video length is 10 seconds then i need to get the picture from 5th second).

    i managed to parse through the file and extract its boxes (atom). i have also managed to get the video length from the mvhd box. also i managed to extract
    1. the time-To-Sample table from stts box,
    2. the sample-To-Chunk table from stcs box,
    3. the chunk-Offset table from stco box,
    4. the sample Size table from stsz box,
    5. the Sync Sample table from stss box

    i know that all the actual media are available in the mdat box and that i need to correlate the above table to find the exact frame offset in the file but my question is how ? the tables data seems to be compressed (specially the time-To-Sample table) but i don’t know how decompress them.

    any help is appreciated.

    below are code samples

    code to convert byte to hex

    public static char[] bytesToHex(byte[] bytes) {
       char[] hexChars = new char[bytes.length * 2];
       for ( int j = 0; j < bytes.length; j++ ) {
           int v = bytes[j] & 0xFF;

           hexChars[j * 2] = hexArray[v >>> 4];
           hexChars[j * 2 + 1] = hexArray[v & 0x0F];            
       }
       return hexChars;
    }

    code for getting the box offset

    final static String MOOV                          = "6D6F6F76";
    final static String MOOV_MVHD                     = "6D766864";
    final static String MOOV_TRAK                     = "7472616B";
    final static String MOOV_TRAK_MDIA                = "6D646961";
    final static String MOOV_TRAK_MDIA_MINF           = "6D696E66";
    final static String MOOV_TRAK_MDIA_MINF_STBL      = "7374626C";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSD = "73747364";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STTS = "73747473";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSS = "73747373";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSC = "73747363";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STCO = "7374636F";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSZ = "7374737A";

    static int getBox(char[] s, int offset, String type) {
       int typeOffset = -1;
       for (int i = offset*2; i-1) {
                   break;
               }
           }
           i+=(size*2);
       }

       return typeOffset;
    }

    code for getting the duration and timescale

    static int[] getDuration(char[] s) {
       int mvhdOffset = getBox(s, 0, MOOV_MVHD);
       int timeScaleStart = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4)*2;
       int timeScaleEnd   = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;

       int durationStart  = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;
       int durationEnd    = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4 + 4)*2;

       String timeScaleHex = new String(Arrays.copyOfRange(s, timeScaleStart, timeScaleEnd));
       String durationHex = new String(Arrays.copyOfRange(s, durationStart, durationEnd));

       int timeScale = Integer.parseInt(timeScaleHex, 16);
       int duration = Integer.parseInt(durationHex, 16);

       int[] result = {duration, timeScale};
       return result;
    }

    code to get the time-To-Sample table

    static int[][] getTimeToSampleTable(char[] s, int trakOffset) {
       int offset = getBox(s, trakOffset, MOOV_TRAK_MDIA_MINF_STBL_STTS);
       int sizeStart = offset*2;
       int sizeEnd   = offset*2 + (4)*2;

       int typeStart = offset*2 + (4)*2;
       int typeEnd   = offset*2 + (4 + 4)*2;

       int noOfEntriesStart = offset*2 + (4 + 4 + 1 + 3)*2;
       int noOfEntriesEnd   = offset*2 + (4 + 4 + 1 + 3 + 4)*2;

       String sizeHex = new String(Arrays.copyOfRange(s, sizeStart, sizeEnd));
       String typeHex = new String(Arrays.copyOfRange(s, typeStart, typeEnd));
       String noOfEntriesHex = new String(Arrays.copyOfRange(s, noOfEntriesStart, noOfEntriesEnd));

       int size = Integer.parseInt(sizeHex, 16);
       int noOfEntries = Integer.parseInt(noOfEntriesHex, 16);

       int[][] timeToSampleTable = new int[noOfEntries][2];

       for (int i = 0; icode>
  • Decompressing time-To-Sample table (STTS) in an MP4 file

    30 mai 2016, par man-r

    i have an mp4 video byte array and i need to generate a thumbnail for it using its middle frame (e.g. if the video length is 10 seconds then i need to get the picture from 5th second).

    i managed to parse through the file and extract its boxes (atom). i have also managed to get the video length from the mvhd box. also i managed to extract
    1. the time-To-Sample table from stts box,
    2. the sample-To-Chunk table from stcs box,
    3. the chunk-Offset table from stco box,
    4. the sample Size table from stsz box,
    5. the Sync Sample table from stss box

    i know that all the actual media are available in the mdat box and that i need to correlate the above table to find the exact frame offset in the file but my question is how ? the tables data seems to be compressed (specially the time-To-Sample table) but i don’t know how decompress them.

    any help is appreciated.

    below are code samples

    code to convert byte to hex

    public static char[] bytesToHex(byte[] bytes) {
       char[] hexChars = new char[bytes.length * 2];
       for ( int j = 0; j < bytes.length; j++ ) {
           int v = bytes[j] & 0xFF;

           hexChars[j * 2] = hexArray[v >>> 4];
           hexChars[j * 2 + 1] = hexArray[v & 0x0F];            
       }
       return hexChars;
    }

    code for getting the box offset

    final static String MOOV                          = "6D6F6F76";
    final static String MOOV_MVHD                     = "6D766864";
    final static String MOOV_TRAK                     = "7472616B";
    final static String MOOV_TRAK_MDIA                = "6D646961";
    final static String MOOV_TRAK_MDIA_MINF           = "6D696E66";
    final static String MOOV_TRAK_MDIA_MINF_STBL      = "7374626C";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSD = "73747364";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STTS = "73747473";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSS = "73747373";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSC = "73747363";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STCO = "7374636F";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSZ = "7374737A";

    static int getBox(char[] s, int offset, String type) {
       int typeOffset = -1;
       for (int i = offset*2; i-1) {
                   break;
               }
           }
           i+=(size*2);
       }

       return typeOffset;
    }

    code for getting the duration and timescale

    static int[] getDuration(char[] s) {
       int mvhdOffset = getBox(s, 0, MOOV_MVHD);
       int timeScaleStart = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4)*2;
       int timeScaleEnd   = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;

       int durationStart  = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;
       int durationEnd    = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4 + 4)*2;

       String timeScaleHex = new String(Arrays.copyOfRange(s, timeScaleStart, timeScaleEnd));
       String durationHex = new String(Arrays.copyOfRange(s, durationStart, durationEnd));

       int timeScale = Integer.parseInt(timeScaleHex, 16);
       int duration = Integer.parseInt(durationHex, 16);

       int[] result = {duration, timeScale};
       return result;
    }

    code to get the time-To-Sample table

    static int[][] getTimeToSampleTable(char[] s, int trakOffset) {
       int offset = getBox(s, trakOffset, MOOV_TRAK_MDIA_MINF_STBL_STTS);
       int sizeStart = offset*2;
       int sizeEnd   = offset*2 + (4)*2;

       int typeStart = offset*2 + (4)*2;
       int typeEnd   = offset*2 + (4 + 4)*2;

       int noOfEntriesStart = offset*2 + (4 + 4 + 1 + 3)*2;
       int noOfEntriesEnd   = offset*2 + (4 + 4 + 1 + 3 + 4)*2;

       String sizeHex = new String(Arrays.copyOfRange(s, sizeStart, sizeEnd));
       String typeHex = new String(Arrays.copyOfRange(s, typeStart, typeEnd));
       String noOfEntriesHex = new String(Arrays.copyOfRange(s, noOfEntriesStart, noOfEntriesEnd));

       int size = Integer.parseInt(sizeHex, 16);
       int noOfEntries = Integer.parseInt(noOfEntriesHex, 16);

       int[][] timeToSampleTable = new int[noOfEntries][2];

       for (int i = 0; icode>