
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (60)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)
Sur d’autres sites (7056)
-
MP4 file data structure
16 décembre 2015, par man-ri 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 boxi 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-ri 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 boxi 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 AshfordI 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 {
 //these calls are to load the video into temporary directory
 final response = await http.get(Uri.parse(videoPath));
 final originalVideo = File ('${(await getTemporaryDirectory()).path}/video.mp4');
 await originalVideo.create(recursive: true);
 await originalVideo.writeAsBytes(response.bodyBytes);
 print('video path' + originalVideo.path);

 //this grabs the watermark image from assets and decodes it
 final byteData = await rootBundle.load(watermarkPath);
 final watermark = File('${(await getTemporaryDirectory()).path}/image.png');
 await watermark.create(recursive: true);
 await watermark.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
 print('watermark path' + watermark.path);

 //this creates temporary directory for new watermarked video
 var tempDir = await getTemporaryDirectory();
 final newVideoPath = '${tempDir.path}/${DateTime.now().microsecondsSinceEpoch}result.mp4';

 //and now attempting to work with ffmpeg package to overlay watermark on video
 await FFmpegKit.execute("-i $originalVideo -i $watermark -filter_complex 'overlay[out]' -map '[out]' $newVideoPath")
 .then((rc) => print('FFmpeg process exited with rc $rc'));
 print('new video path' + newVideoPath);

return newVideoPath;
 }
</string>


The logs give the file paths and also give this


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