
Recherche avancée
Autres articles (104)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP 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 (...) -
Formulaire personnalisable
21 juin 2013, parCette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire. (...)
Sur d’autres sites (7249)
-
Swift - Workaround/Alternative to M3u8 to play mp4 segment or merge segments into mp4
14 mai 2020, par STerrierI used AVAssetExportSession to download a session URL but the issue that you can't download live stream so to get around it, the live stream is split into 10 seconds mp4 segments that are downloaded using an m3u8 to create the URLs. I then use AVAssetExportSession to merge those mp4 segments.



I can merge those clips one by one into one mp4 file which is what I want but as the file gets bigger, the longer it takes as I am dealing with thousands of segments which becomes unpractical.



I thought about using AVplayerLooper but I cannot scrub, rewind or forward through the mp4 segment like a single video.



Is there a way to combine the mp4 clips together to play as one video as the m3u8 does without merging ? or is there a fast way to merge videos ?



Note : The server uses FFmpeg but I am not allowed to use FFmpeg or pods in the app.



below is the function to merge videos



var mp4Array: [AVAsset] = []
var avAssetExportSession: AVAssetExportSession?

var firstAsset: AVAsset?
var secondAsset: AVAsset?

func mergeVideos() {

 firstAsset = mp4Array.first
 secondAsset = mp4Array[1]

 guard let firstAsset = firstAsset, let secondAsset = secondAsset else { return }
 let mixComposition = AVMutableComposition()

 guard let firstTrack = mixComposition.addMutableTrack(withMediaType: .video, preferredTrackID: Int32(kCMPersistentTrackID_Invalid)) else {return}

 do {

 try firstTrack.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: firstAsset.duration),
 of: firstAsset.tracks(withMediaType: .video)[0],
 at: CMTime.zero)

 } catch {
 print("Couldn't load track 1")
 return
 }

 guard let secondTrack = mixComposition.addMutableTrack(withMediaType: .video, preferredTrackID: Int32(kCMPersistentTrackID_Invalid)) else {return}

 do {
 try secondTrack.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: secondAsset.duration),
 of: secondAsset.tracks(withMediaType: .video)[0],
 at: firstAsset.duration)
 } catch {
 print("couldn't load track 2")
 return
 }

 let mainInstruction = AVMutableVideoCompositionInstruction()
 mainInstruction.timeRange = CMTimeRangeMake(start: CMTime.zero, duration: CMTimeAdd(firstAsset.duration, secondAsset.duration))

 let firstAssetInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: firstTrack)
 firstAssetInstruction.setOpacity(0.0, at: firstAsset.duration)

 let secondAssetInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: secondTrack)

 mainInstruction.layerInstructions = [firstAssetInstruction, secondAssetInstruction]
 let mainComposition = AVMutableVideoComposition()
 mainComposition.instructions = [mainInstruction]
 mainComposition.frameDuration = CMTimeMake(value: 1, timescale: 30)
 mainComposition.renderSize = firstTrack.naturalSize

 guard let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
 let url = documentDirectory.appendingPathComponent("MergedVideos/mergeVideo\(videoInt).mp4")

 guard let exporter = AVAssetExportSession(asset: mixComposition, presetName: AVAssetExportPresetHighestQuality) else {return}

 exporter.outputURL = url
 exporter.outputFileType = AVFileType.mp4
 exporter.shouldOptimizeForNetworkUse = true
 exporter.videoComposition = mainComposition

 exporter.exportAsynchronously {

 if exporter.status == .completed {
 let avasset = AVAsset(url:url)
 self.mergeUrl = avasset
 if self.mp4Array.count > 1{
 print("This add the merged video to the front of the mp4array")
 self.mp4Array.remove(at: 1)
 self.mp4Array.removeFirst()
 self.videoInt = self.videoInt + 1
 self.mp4Array.append(self.mergeUrl!)
 self.mp4Array.bringToFront(item: self.mp4Array.last!)
 }

 if (self.mp4Array.count > 1){
 if self.mergeUrl != nil {
 self.mergeVideos()
 }
 } else {
 var numberofvideosdeleted = 0
 while (numberofvideosdeleted < self.videoInt - 1){
 do {
 print("deleting")
 let url = documentDirectory.appendingPathComponent("MergedVideos/mergeVideo\(numberofvideosdeleted).mp4")
 try FileManager.default.removeItem(at: url)
 numberofvideosdeleted = numberofvideosdeleted + 1
 } catch {
 print("Error removing videos")
 }
 }

 self.deleteCurrentSegementsInFolder()
 }
 }
 }
}



-
Add better class names to icons to avoid css conflicts on bar-ui demo
25 août 2016, par sjardimAdd better class names to icons to avoid css conflicts on bar-ui demo
Changes for the . Add “sm2-icon-“ on the icons so their styles won’t
conflict with other CSS on the page, like the “.menu” class on Zurb’s
Foundation 6 -
how to convert AVFrame to class
21 juin 2020, par Rabbit_DriversIn order to facilitate the management of AVFrame resources,I want to convert AVFrame to class,but I don't know how to write my copy constructor function and assignment function with default AVFrame(use av_frame_alloc() to alloc).