Recherche avancée

Médias (91)

Autres articles (85)

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (6125)

  • Full HD video converted to FLV, slow playback in browser

    12 février 2012, par Boyan Georgiev

    I rendered a full HD video using Adobe AfterEffects CS5 in mp4 format. It plays just fine. I've got this video app to which I fed the mp4 file. The video app converts the mp4 to flv format and makes the video available via a web page. I've downloaded the resulting flv file to my local PC - it plays just fine in my VLC player. But, the problem is I'm getting awful playback inside my browser.

    I've made sure the issue is not bandwidth related.
    Both original mp4 file, and ffmpeg-converted FLV file, play perfectly using VLC player.
    I've tested the FLV file with two players - Agryia FLV Player Elite and JW Player. Both players play the video awfully - really slow and very choppy.

    Here's my ffmpeg -i myflvfile.flv :
    `

    Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.92 (719/12)
    Input #0, flv, from '94044631305552037.flv':
    Metadata:
    duration        : 146
    width           : 1920
    height          : 1080
    videodatarate   : 684
    framerate       : 60
    videocodecid    : 7
    audiodatarate   : 62
    audiosamplerate : 22050
    audiosamplesize : 16
    stereo          : true
    audiocodecid    : 2
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2012-02-10 00:55:19
    encoder         : Lavf52.111.0
    filesize        : 61969316
    Duration: 00:02:25.77, start: 0.034000, bitrate: 764 kb/s
    Stream #0.0: Video: h264 (High), yuv420p, 1920x1080 [PAR 3:4 DAR 4:3], 700 kb/s, 59.92 tbr, 1k tbn, 119.88 tbc
    Stream #0.1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s`

    Can any one point me in the right direction here ? Why is playback perfect with VLC player of both the mp4 and the flv file on my local PC, yet in my browser, using two different players, the playback is so bad ?

    PS Here's my convert command :

    ffmpeg -y -i /var/www/sandverlag.com/htdocs/rmtk/videos/originals/94044631305552038.mp4 -vcodec libx264 -ar 22050 -ac 2 -vb 700000 -s 1920x1080 -crf 22 -threads 0 -f flv /var/www/sandverlag.com/htdocs/rmtk/videos/converted/94044631305552038.flv > /dev/null &    
  • 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;

  • Script timing with FFMPEG and PHP

    23 juin 2014, par egekhter

    I’m running into a very strange bug.

    Here’s my command console output :

    ffmpeg -i /transcodes/original/883_1000_1403436916_00001.MTS -y -vcodec libx264 -tune zerolatency -

    movflags faststart -crf 20 -profile:v high -level:v 4.0 -maxrate 6000k -bufsize 12000k -acodec libfdk_aac -b:a 256k /transcodes/883_1000_1403436916_00001_HQ.mp4 -vcodec libx264 -s 848x480 -tune zerolatency -movflags faststart -crf 25 -profile:v main -level:v 3.1 -maxrate 1400k -bufsize 1400k -acodec libfdk_aac -b:a 256k /transcodes/883_1000_1403436916_00001_SQ.mp4 -ss 166.16 -f image2 -vframes 1 /transcodes/883_1000_1403436916_00001_poster.jpg -ss 166.16 -f image2 -vf scale=-1:240 -vframes 1 /transcodes/883_1000_1403436916_00001_thumb.jpg

    ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
     built on Jun 13 2014 02:40:27 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
     configuration: --prefix=/home/ubuntu/ffmpeg_build --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --bindir=/home/ubuntu/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
     libavutil      52. 89.100 / 52. 89.100
     libavcodec     55. 66.100 / 55. 66.100
     libavformat    55. 43.100 / 55. 43.100
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  8.100 /  4.  8.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mpegts, from '/transcodes/original/883_1000_1403436916_00001.MTS':
     Duration: 00:04:11.74, start: 0.382511, bitrate: 25222 kb/s
     Program 1
       Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
       Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
       Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    [swscaler @ 0x216fe40] deprecated pixel format used, make sure you did set range correctly
    [swscaler @ 0x2188c20] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0x2143e60] using SAR=1/1
    [libx264 @ 0x2143e60] MB rate (489110) > level limit (245760)
    [libx264 @ 0x2143e60] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x2143e60] profile High, level 4.0
    [libx264 @ 0x2143e60] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=6000 vbv_bufsize=12000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
    [libx264 @ 0x2150680] using SAR=160/159
    [libx264 @ 0x2150680] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x2150680] profile Main, level 3.1
    [libx264 @ 0x2150680] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1400 vbv_bufsize=1400 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '/transcodes/883_1000_1403436916_00001_HQ.mp4':
     Metadata:
       encoder         : Lavf55.43.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, max. 6000 kb/s, 59.94 fps, 60k tbn, 59.94 tbc
       Metadata:
         encoder         : Lavc55.66.100 libx264
       Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, s16, 256 kb/s
       Metadata:
         encoder         : Lavc55.66.100 libfdk_aac
    Output #1, mp4, to '/transcodes/883_1000_1403436916_00001_SQ.mp4':
     Metadata:
       encoder         : Lavf55.43.100
       Stream #1:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 848x480 [SAR 160:159 DAR 16:9], q=-1--1, max. 1400 kb/s, 59.94 fps, 60k tbn, 59.94 tbc
       Metadata:
         encoder         : Lavc55.66.100 libx264
       Stream #1:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, s16, 256 kb/s
       Metadata:
         encoder         : Lavc55.66.100 libfdk_aac
    Output #2, image2, to '/transcodes/883_1000_1403436916_00001_poster.jpg':
     Metadata:
       encoder         : Lavf55.43.100
       Stream #2:0: Video: mjpeg, yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
       Metadata:
         encoder         : Lavc55.66.100 mjpeg
    Output #3, image2, to '/transcodes/883_1000_1403436916_00001_thumb.jpg':
     Metadata:
       encoder         : Lavf55.43.100
       Stream #3:0: Video: mjpeg, yuvj420p, 427x240 [SAR 1280:1281 DAR 16:9], q=2-31, 200 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
       Metadata:
         encoder         : Lavc55.66.100 mjpeg
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
     Stream #0:0 -> #1:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #1:1 (ac3 (native) -> aac (libfdk_aac))
     Stream #0:0 -> #2:0 (h264 (native) -> mjpeg (mjpeg))
     Stream #0:0 -> #3:0 (h264 (native) -> mjpeg (mjpeg))
    frame=15090 fps=1.0 q=39.0 q=30.0 q=6.6 q=4.3 size=  193843kB time=00:04:11.75 bitrate=6307.7kbits/s dup=0 drop=15088    
    [mp4 @ 0x210ae00] Starting second pass: moving the moov atom to the beginning of the file
    [mp4 @ 0x210ae00] Unable to re-open /transcodes/883_1000_1403436916_00001_HQ.mp4 output file for the second pass (faststart)
    [mp4 @ 0x214fc20] Starting second pass: moving the moov atom to the beginning of the file
    [mp4 @ 0x214fc20] Unable to re-open /transcodes/883_1000_1403436916_00001_SQ.mp4 output file for the second pass (faststart)
    frame=15090 fps=1.0 q=39.0 Lq=30.0 q=6.6 q=4.3 size=  193843kB time=00:04:11.77 bitrate=6307.1kbits/s dup=0 drop=15088    
    video:212914kB audio:15741kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [libx264 @ 0x2143e60] frame I:162   Avg QP:23.31  size: 38205
    [libx264 @ 0x2143e60] frame P:14928 Avg QP:25.47  size: 12322
    [libx264 @ 0x2143e60] mb I  I16..4: 24.9% 70.4%  4.6%
    [libx264 @ 0x2143e60] mb P  I16..4:  2.2%  3.2%  0.0%  P16..4: 38.3%  3.7%  4.3%  0.0%  0.0%    skip:48.3%
    [libx264 @ 0x2143e60] 8x8 transform intra:60.6% inter:94.6%
    [libx264 @ 0x2143e60] coded y,uvDC,uvAC intra: 25.5% 50.7% 2.8% inter: 9.7% 17.3% 0.0%
    [libx264 @ 0x2143e60] i16 v,h,dc,p: 43% 17% 10% 29%
    [libx264 @ 0x2143e60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 13% 34%  4%  4%  4%  5%  3%  3%
    [libx264 @ 0x2143e60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 18% 13%  5%  7%  6%  7%  4%  3%
    [libx264 @ 0x2143e60] i8c dc,h,v,p: 64% 15% 19%  2%
    [libx264 @ 0x2143e60] Weighted P-Frames: Y:0.2% UV:0.0%
    [libx264 @ 0x2143e60] ref P L0: 67.7% 14.5% 13.8%  4.0%  0.0%
    [libx264 @ 0x2143e60] kb/s:6042.08
    [libx264 @ 0x2150680] frame I:72    Avg QP:24.70  size: 14016
    [libx264 @ 0x2150680] frame P:15018 Avg QP:28.46  size:  1783
    [libx264 @ 0x2150680] mb I  I16..4: 39.4%  0.0% 60.6%
    [libx264 @ 0x2150680] mb P  I16..4:  0.8%  0.0%  0.3%  P16..4: 36.3%  4.1%  2.6%  0.0%  0.0%    skip:56.0%
    [libx264 @ 0x2150680] coded y,uvDC,uvAC intra: 32.1% 41.1% 7.1% inter: 3.9% 6.6% 0.1%
    [libx264 @ 0x2150680] i16 v,h,dc,p: 50% 12% 10% 27%
    [libx264 @ 0x2150680] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 15% 22%  5%  5%  5%  6%  5%  3%
    [libx264 @ 0x2150680] i8c dc,h,v,p: 67% 11% 19%  3%
    [libx264 @ 0x2150680] Weighted P-Frames: Y:0.7% UV:0.1%
    [libx264 @ 0x2150680] ref P L0: 65.0% 22.3% 10.0%  2.6%  0.0%
    [libx264 @ 0x2150680] kb/s:882.93

    I’ve tried adding sleep(5) after :

           exec($cmd, $out, $ret);

    to give the script time to move the moov atom to the front before uploading the local file to s3 and then deleting the local file, but it is not 100% reliable.

    Any ideas ?