Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (36)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

Sur d’autres sites (8253)

  • 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>
  • Flutter : FFmpeg Not Executing Filter

    5 novembre 2022, par Dennis Ashford

    I am downloading a video from Firebase and then trying to apply a watermark to that video that will then be saved in a temporary directory in the cache. I am using the ffmpeg_kit_flutter package to do this. There is very little online about how this should work in Flutter.

    


    The video and image are loaded and stored in the cache properly. However, the FFmpegKit.execute call is not working and does not create a new output file in the cache. Any suggestions on how to make that function execute ? Are the FFmpeg commands correct ?

    


    Future<string> waterMarkVideo(String videoPath, String watermarkPath) async {&#xA;    //these calls are to load the video into temporary directory&#xA;    final response = await http.get(Uri.parse(videoPath));&#xA;    final originalVideo = File (&#x27;${(await getTemporaryDirectory()).path}/video.mp4&#x27;);&#xA;    await originalVideo.create(recursive: true);&#xA;    await originalVideo.writeAsBytes(response.bodyBytes);&#xA;    print(&#x27;video path&#x27; &#x2B; originalVideo.path);&#xA;&#xA;    //this grabs the watermark image from assets and decodes it&#xA;    final byteData = await rootBundle.load(watermarkPath);&#xA;    final watermark = File(&#x27;${(await getTemporaryDirectory()).path}/image.png&#x27;);&#xA;    await watermark.create(recursive: true);&#xA;    await watermark.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));&#xA;    print(&#x27;watermark path&#x27; &#x2B; watermark.path);&#xA;&#xA;    //this creates temporary directory for new watermarked video&#xA;    var tempDir = await getTemporaryDirectory();&#xA;    final newVideoPath = &#x27;${tempDir.path}/${DateTime.now().microsecondsSinceEpoch}result.mp4&#x27;;&#xA;&#xA;    //and now attempting to work with ffmpeg package to overlay watermark on video&#xA;    await FFmpegKit.execute("-i $originalVideo -i $watermark -filter_complex &#x27;overlay[out]&#x27; -map &#x27;[out]&#x27; $newVideoPath")&#xA;    .then((rc) => print(&#x27;FFmpeg process exited with rc $rc&#x27;));&#xA;    print(&#x27;new video path&#x27; &#x2B; newVideoPath);&#xA;&#xA;return newVideoPath;&#xA;  }&#xA;</string>

    &#xA;

    The logs give the file paths and also give this

    &#xA;

    FFmpegKitFlutterPlugin 0x600000000fe0 started listening to events on 0x600001a4b280.&#xA;flutter: Loaded ffmpeg-kit-flutter-ios-https-x86_64-4.5.1.&#xA;flutter: FFmpeg process exited with rc Instance of &#x27;FFmpegSession&#x27;&#xA;

    &#xA;