Recherche avancée

Médias (0)

Mot : - Tags -/serveur

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (79)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

Sur d’autres sites (6857)

  • Minutes and seconds as variabe in Python

    7 avril 2014, par Badr Hari

    How can I store hours/minutes/seconds as variable in python ?

    For example :

    time = "01:30" # 1 minute and 30 seconds
    time2 = time + 10 seconds

    Basically a program (using FFMPEG) will decide when to start playing an audio file but the value can be changed in +-10 seconds, the questions is how can I store this value.

    Last try to clarify my question :
    time variable is "01:30" which clearly represent the time, 01 min 30 seconds, how can I add 10 seconds to it to make the variable 10:40, clearly 01:30+:00:10 is not the solution.

    Sorry for confusion folks, I do my best.

  • Minutes and seconds as a variable in Python

    28 juin 2014, par Badr Hari

    How can I store hours/minutes/seconds as variable in python ?

    For example :

    time = "01:30" # 1 minute and 30 seconds
    time2 = time + 10 seconds

    Basically a program (using FFMPEG) will decide when to start playing an audio file but the value can be changed in +-10 seconds. The questions is how can I store this value ?

    To clarify my question :
    The time variable is "01:30" which clearly represent the time, 01 min 30 seconds. How can I add 10 seconds to it to make the variable 10:40 ? Clearly 01:30+:00:10 is not the solution.

  • HLS video not playing in Angular using Hls.js

    5 avril 2023, par Jose A. Matarán

    I am trying to play an HLS video using Hls.js in an Angular component. Here is the component code :

    


    import { Component, ElementRef, ViewChild, AfterViewInit } from &#x27;@angular/core&#x27;;&#xA;import Hls from &#x27;hls.js&#x27;;&#xA;&#xA;@Component({&#xA;  selector: &#x27;app-ver-recurso&#x27;,&#xA;  templateUrl: &#x27;./ver-recurso.component.html&#x27;,&#xA;  styleUrls: [&#x27;./ver-recurso.component.css&#x27;]&#xA;})&#xA;export class VerRecursoComponent implements AfterViewInit {&#xA;  @ViewChild(&#x27;videoPlayer&#x27;) videoPlayer!: ElementRef<htmlvideoelement>;&#xA;  hls!: Hls;&#xA;&#xA;  ngAfterViewInit(): void {&#xA;    this.hls = new Hls();&#xA;&#xA;    const video = this.videoPlayer.nativeElement;&#xA;    const watermarkText = &#x27;MARCA_DE_AGUA&#x27;;&#xA;&#xA;    this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {&#xA;      this.hls.loadSource(`http://localhost:8080/video/playlist.m3u8?watermarkText=${encodeURIComponent(watermarkText)}`);&#xA;    });&#xA;&#xA;    this.hls.attachMedia(video);&#xA;  }&#xA;&#xA;  loadVideo() {&#xA;    const watermarkText = &#x27;Marca de agua personalizada&#x27;;&#xA;    const video = this.videoPlayer.nativeElement;&#xA;    const hlsBaseUrl = &#x27;http://localhost:8080/video&#x27;;&#xA;&#xA;    if (Hls.isSupported()) {&#xA;      this.hls.loadSource(`${hlsBaseUrl}/playlist.m3u8?watermarkText=${encodeURIComponent(watermarkText)}`);&#xA;      this.hls.attachMedia(video);&#xA;      this.hls.on(Hls.Events.MANIFEST_PARSED, () => {&#xA;        video.play();&#xA;      });&#xA;    } else if (video.canPlayType(&#x27;application/vnd.apple.mpegurl&#x27;)) {&#xA;      video.src = `${hlsBaseUrl}/playlist.m3u8?watermarkText=${encodeURIComponent(watermarkText)}`;&#xA;      video.addEventListener(&#x27;loadedmetadata&#x27;, () => {&#xA;        video.play();&#xA;      });&#xA;    }&#xA;  }&#xA;}&#xA;</htmlvideoelement>

    &#xA;

    I'm not sure what's going wrong, as the requests to the playlist and the segments seem to be working correctly, but the video never plays. Is there anything obvious that I'm missing here ?

    &#xA;

    On the backend side, I have a Spring Boot application that generates and returns the playlist file, as you can see.

    &#xA;

    @RestController&#xA;public class VideoController {&#xA;    @Autowired&#xA;    private VideoService videoService;&#xA;&#xA;    @GetMapping("/video/{segmentFilename}")&#xA;    public ResponseEntity<resource> getHlsVideoSegment(@PathVariable String segmentFilename, @RequestParam String watermarkText) {&#xA;        String inputVideoPath = "/Users/jose/PROYECTOS/VARIOS/oposhield/oposhield-back/repo/202204M-20230111.mp4";&#xA;        String hlsOutputPath = "/Users/jose/PROYECTOS/VARIOS/oposhield/oposhield-back/repo/temporal";&#xA;        String segmentPath = Paths.get(hlsOutputPath, segmentFilename).toString();&#xA;&#xA;        if (!Files.exists(Paths.get(hlsOutputPath, "playlist.m3u8"))) {&#xA;            videoService.generateHlsStream(inputVideoPath, watermarkText, hlsOutputPath);&#xA;        }&#xA;&#xA;        // Espera a que est&#xE9; disponible el segmento de video necesario.&#xA;        while (!Files.exists(Paths.get(segmentPath))) {&#xA;            try {&#xA;                Thread.sleep(1000);&#xA;            } catch (InterruptedException e) {&#xA;                e.printStackTrace();&#xA;            }&#xA;        }&#xA;&#xA;        Resource resource;&#xA;        try {&#xA;            resource = new UrlResource(Paths.get(segmentPath).toUri());&#xA;        } catch (Exception e) {&#xA;            return ResponseEntity.badRequest().build();&#xA;        }&#xA;&#xA;        return ResponseEntity.ok()&#xA;                .contentType(MediaType.parseMediaType("application/vnd.apple.mpegurl"))&#xA;                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" &#x2B; resource.getFilename() &#x2B; "\"")&#xA;                .body(resource);&#xA;    }&#xA;&#xA;    @GetMapping("/video/{segmentFilename}.ts")&#xA;    public ResponseEntity<resource> getHlsVideoTsSegment(@PathVariable String segmentFilename) {&#xA;        String hlsOutputPath = "/Users/jose/PROYECTOS/VARIOS/oposhield/oposhield-back/repo/temporal";&#xA;        String segmentPath = Paths.get(hlsOutputPath, segmentFilename &#x2B; ".ts").toString();&#xA;&#xA;        // Espera a que est&#xE9; disponible el segmento de video necesario.&#xA;        while (!Files.exists(Paths.get(segmentPath))) {&#xA;            try {&#xA;                Thread.sleep(1000);&#xA;            } catch (InterruptedException e) {&#xA;                e.printStackTrace();&#xA;            }&#xA;        }&#xA;&#xA;        Resource resource;&#xA;        try {&#xA;            resource = new UrlResource(Paths.get(segmentPath).toUri());&#xA;        } catch (Exception e) {&#xA;            return ResponseEntity.badRequest().build();&#xA;        }&#xA;&#xA;        return ResponseEntity.ok()&#xA;                .contentType(MediaType.parseMediaType("video/mp2t"))&#xA;                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" &#x2B; resource.getFilename() &#x2B; "\"")&#xA;                .body(resource);&#xA;    }&#xA;</resource></resource>

    &#xA;

    package dev.mataran.oposhieldback.service;&#xA;&#xA;&#xA;import org.springframework.stereotype.Service;&#xA;&#xA;import java.io.BufferedReader;&#xA;import java.io.InputStreamReader;&#xA;&#xA;import java.util.concurrent.ExecutorService;&#xA;import java.util.concurrent.Executors;&#xA;&#xA;@Service&#xA;public class VideoService {&#xA;    private Process process;&#xA;    private ExecutorService executorService = Executors.newSingleThreadExecutor();&#xA;&#xA;    public void generateHlsStream(String inputVideoPath, String watermarkText, String outputPath) {&#xA;        Runnable task = () -> {&#xA;            try {&#xA;                if (process != null) {&#xA;                    process.destroy();&#xA;                }&#xA;&#xA;                String hlsOutputFile = outputPath &#x2B; "/playlist.m3u8";&#xA;                String command = String.format("ffmpeg -i %s -vf drawtext=text=&#x27;%s&#x27;:x=10:y=10:fontsize=24:fontcolor=white -codec:v libx264 -crf 21 -preset veryfast -g 50 -sc_threshold 0 -map 0 -flags -global_header -hls_time 4 -hls_list_size 0 -hls_flags delete_segments&#x2B;append_list -f hls %s", inputVideoPath, watermarkText, hlsOutputFile);&#xA;                process = Runtime.getRuntime().exec(command);&#xA;                BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));&#xA;                String line;&#xA;                while ((line = reader.readLine()) != null) {&#xA;                    System.out.println(line);&#xA;                }&#xA;            } catch (Exception e) {&#xA;                e.printStackTrace();&#xA;            }&#xA;        };&#xA;        executorService.submit(task);&#xA;    }&#xA;}&#xA;

    &#xA;