Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

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

Autres articles (65)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • 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) (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 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 (...)

Sur d’autres sites (3218)

  • 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;

  • How to pass BGR NumPy arrays directly to FFMPEG with CUDA support

    4 juillet 2022, par Ξένη Γήινος

    I am using cv2 to edit images and create a video from the frames with FFMPEG. See this post for more details.

    &#xA;

    The images are 3D RGB NumPy arrays (shape is like [h, w, 3]), they are stored in a Python list.

    &#xA;

    Yep, I know cv2 has a VideoWriter and I have used it before, but it is very inadequate to meet my needs.

    &#xA;

    Simply put, it can only use an FFMPEG version that comes with it, that version does not support CUDA and uses up all CPU time when generating the videos while not using any GPU time at all, the output is way too big and I can't pass many FFMPEG parameters to the VideoWrite initiation.

    &#xA;

    I downloaded precompiled binaries of FFMPEG for Windows with CUDA support here, I am using Windows 10 21H1 x64, and my GPU is NVIDIA Geforce GTX 1050 Ti.

    &#xA;

    Anyways I need to mess with all the parameters found here and there to find the best compromise between quality and compression, like this :

    &#xA;

    command = &#x27;{} -y -stream_loop {} -framerate {} -hwaccel cuda -hwaccel_output_format cuda -i {}/{}_%d.png -c:v hevc_nvenc -preset 18 -tune 1 -rc vbr -cq {} -multipass 2 -b:v {} -vf scale={}:{} {}&#x27;&#xA;os.system(command.format(FFMPEG, loops-1, fps, tmp_folder, file_name, quality, bitrate, frame_width, frame_height, outfile))&#xA;

    &#xA;

    I need to use exactly the binary I downloaded and specify as many parameters as I can to achieve the optimal result.

    &#xA;

    Currently I can only save the arrays to a disk as images and use the images as input of FFMPEG, and that is slow but I need exactly that binary and all those parameters.

    &#xA;

    After hours of Google searching I found ffmpeg-python, which seems perfect for the job, and I even found this  : I can pass the binary path as an argument to the run function, this

    &#xA;

    import ffmpeg&#xA;import io&#xA;&#xA;&#xA;def vidwrite(fn, images, framerate=60, vcodec=&#x27;libx264&#x27;):&#xA;    if not isinstance(images, np.ndarray):&#xA;        images = np.asarray(images)&#xA;    _,height,width,channels = images.shape&#xA;    process = (&#xA;        ffmpeg&#xA;            .input(&#x27;pipe:&#x27;, format=&#x27;rawvideo&#x27;, pix_fmt=&#x27;rgb24&#x27;, s=&#x27;{}x{}&#x27;.format(width, height), r=framerate)&#xA;            .output(fn, pix_fmt=&#x27;yuv420p&#x27;, vcodec=vcodec, r=framerate)&#xA;            .overwrite_output()&#xA;            .run_async(pipe_stdin=True, overwrite_output=True, pipe_stderr=True)&#xA;    )&#xA;    for frame in images:&#xA;        try:&#xA;            process.stdin.write(&#xA;                frame.astype(np.uint8).tobytes()&#xA;            )&#xA;        except Exception as e: # should probably be an exception related to process.stdin.write&#xA;            for line in io.TextIOWrapper(process.stderr, encoding="utf-8"): # I didn&#x27;t know how to get the stderr from the process, but this worked for me&#xA;                print(line) # &lt;-- print all the lines in the processes stderr after it has errored&#xA;            process.stdin.close()&#xA;            process.wait()&#xA;            return # cant run anymore so end the for loop and the function execution&#xA;

    &#xA;

    However I need to pass all those parameters and possibly many more to the process and I am not sure where these parameters should be passed to (where should stream_loop go ? What about hwaccel, hwaccel_output_format, multipass...?).

    &#xA;

    How do I properly pipeline a bunch of NumPy arrays to an FFMPEG process spawned by an binary that supports CUDA and pass all sorts of arguments to the initialization of that process ?

    &#xA;

  • ffmpeg simple re-mux short video : Invalid data found when processing input

    19 mai 2021, par Nic

    I try to remux (surveillance cam) raw AVC files (file header begins with "STL Stream Format v1.0") to get playable MP4 files.

    &#xA;

    The command I used does work for the longer file but not for the short one :

    &#xA;

    .\ffmpeg.exe -framerate 25 -i video.ssf -c copy video.mp4&#xA;

    &#xA;

    Good result for long video :

    &#xA;

    Trailing option(s) found in the command: may be ignored.&#xA;Input #0, h264, from &#x27;file.ssf&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;  Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 704x576, 25 fps, 25 tbr, 1200k tbn, 50 tbc&#xA;Output #0, mp4, to &#x27;file.mp4&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.76.100&#xA;  Stream #0:0: Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(progressive), 704x576, q=2-31, 25 fps, 25 tbr, 1200k tbn, 1200k tbc&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[mp4 @ 0000020c1a048240] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly&#xA;[NULL @ 0000020c1997f640] sps_id 32 out of range00:00:00.00 bitrate=384000.0kbits/s speed= 0.2x&#xA;frame= 4814 fps=0.0 q=-1.0 Lsize=   21829kB time=00:03:12.52 bitrate= 928.9kbits/s speed=2.34e&#x2B;03x&#xA;video:21808kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.098001%&#xA;

    &#xA;

    Bad result for short video :

    &#xA;

    [AVIOContext @ 000002c6db8e6d80] Statistics: 846679 bytes read, 0 seeks&#xA;video.ssf: Invalid data found when processing input&#xA;

    &#xA;

    Is there anything I can adjust to fix this ?

    &#xA;

    Thanks !

    &#xA;

    Nico

    &#xA;