Recherche avancée

Médias (2)

Mot : - Tags -/rotation

Autres articles (78)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (6846)

  • Video converted with FFMPEG cannot be played

    20 mai 2023, par EugeneH

    I am developing a function that converts RTSP files to HLS and displays them in a web browser (chrome).
Development is node.js, I am using ffmpeg.

    


    The part that is converted to HLS and displayed on the screen plays well without any problems.
Video cannot be played the moment the folder is changed for file management.

    


    This is the existing working ffmpeg code and m3u8 code.

    


     ffmpeg -rtsp_transport tcp -i rtsp://210.99.70.120:1935/live/cctv001.stream -c:v copy -f hls -hls_time 1 -hls_segment_type mpegts -hls_flags delete_segments+independent_segments+omit_endlist -hls_list_size 0 -master_pl_name playlist.m3u8 -hls_segment_filename /Users/name/Movies/cam/1/hls/1684560902700_%06d.ts -var_stream_map v:0 /Users/name/Movies/cam/1/hls/1684560902700_playlist.m3u8

Local Path : /Users/name/Movies/cam/1/hls/1684560902700_playlist.m3u8
EndPoint : http://localhost:3000/video/cam/1/hls/1684560902700_playlist.m3u8
 #EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:2.000000,
1684560902700_000000.ts
#EXTINF:1.969000,
1684560902700_000001.ts
#EXTINF:2.000000,
1684560902700_000002.ts
#EXTINF:2.015000,
1684560902700_000003.ts


    


    This is the ffmpeg code and the m3u8 code with the path added.(Video not played)

    


    ffmpeg -rtsp_transport tcp -i rtsp://210.99.70.120:1935/live/cctv001.stream -c:v copy -f hls -hls_time 1 -hls_segment_type mpegts -hls_flags delete_segments+independent_segments+omit_endlist -hls_list_size 0 -master_pl_name playlist.m3u8 -hls_segment_filename /Users/name/Movies/cam/1/hls/1684561736286/cam_%06d.ts -var_stream_map v:0 /Users/name/Movies/cam/1/hls/1684561736286/playlist.m3u8

Local Path : /Users/name/Movies/cam/1/hls/1684561736286/playlist.m3u8
EndPoint : http://localhost:3000/video/cam/1/hls/1684561736286/playlist.m3u8
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:1.986000,
cam_000000.ts
#EXTINF:1.984000,
cam_000001.ts
#EXTINF:2.000000,
cam_000002.ts
#EXTINF:2.000000,
cam_000003.ts


    


    The difference is the file name and the folder created one step further.

    


    If you change POSIX from file name to folder name, you will not know the problem of not playing the video.
Can someone please explain this ?

    


  • RTMP streaming not working with fluent-ffmpeg and gl

    15 avril 2023, par Smile

    I'm trying to send opengl rendering results to rtmp using gl and fluent-ffmpeg packages.
    
The render function writes opengl output to glBuf.
    
And the render function is called about 60 times per second.
    
And it calls ffmpeg with that glBuf as input.

    


    import ffmpeg from "fluent-ffmpeg";
import GL from "gl";
import { env } from "./env";
import { PassThrough } from "stream";

const WIDTH = 1920;
const HEIGHT = 1080;
const gl = GL(WIDTH, HEIGHT);

const glBuf = new PassThrough();
const render = () => {
  gl.viewport(0, 0, WIDTH, HEIGHT);
  gl.clearColor(0, 0, 0, 1);
  gl.clear(gl.COLOR_BUFFER_BIT);

  const pixels = new Uint8Array(WIDTH * HEIGHT * 4);
  gl.readPixels(0, 0, WIDTH, HEIGHT, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
  glBuf.write(pixels);
};

const FRAMES = 10;
setInterval(() => {
  for (let i = 0; i < FRAMES; i++) {
    render();
  }
}, FRAMES * 1.1 * (1000 / 60));

ffmpeg()
  .input(glBuf)
  .inputFormat("rawvideo")
  .inputOptions([`-video_size ${WIDTH}x${HEIGHT}`, "-pix_fmt rgba"])
  .inputFPS(60)
  .outputFormat("flv")
  .outputOptions([
    "-c:v libx264",
    "-preset veryfast",
    "-maxrate 3000k",
    "-bufsize 6000k",
    "-pix_fmt yuv420p",
    "-g 60",
    "-c:a aac",
    "-b:a 160k",
    "-ac 2",
  ])
  .on("error", (err) => {
    console.error(err);
  })
  .output(`${env.stream_url}/${env.stream_key}`)
  .run();


    


    However, stream health shows No data. That is, the data is ignored.
    
Not works

    


    So I modified the code to save flv file. It works then.

    


    import ffmpeg from "fluent-ffmpeg";
import GL from "gl";
import { env } from "./env";
import { PassThrough } from "stream";

const WIDTH = 1920;
const HEIGHT = 1080;
const gl = GL(WIDTH, HEIGHT);

const glBuf = new PassThrough();
const render = () => {
  gl.viewport(0, 0, WIDTH, HEIGHT);
  gl.clearColor(0, 0, 0, 1);
  gl.clear(gl.COLOR_BUFFER_BIT);

  const pixels = new Uint8Array(WIDTH * HEIGHT * 4);
  gl.readPixels(0, 0, WIDTH, HEIGHT, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
  glBuf.write(pixels);
};

const FRAMES = 10;
const renderInterval = setInterval(() => {
  for (let i = 0; i < FRAMES; i++) {
    render();
  }
}, FRAMES * 1.1 * (1000 / 60));

setTimeout(() => {
  clearInterval(renderInterval);
  glBuf.end();
  console.log("done!");
}, 3000);

ffmpeg()
  .input(glBuf)
  .inputFormat("rawvideo")
  .inputOptions([`-video_size ${WIDTH}x${HEIGHT}`, "-pix_fmt rgba"])
  .inputFPS(60)
  .outputFormat("flv")
  .outputOptions([
    "-c:v libx264",
    "-preset veryfast",
    "-maxrate 3000k",
    "-bufsize 6000k",
    "-pix_fmt yuv420p",
    "-g 60",
    "-c:a aac",
    "-b:a 160k",
    "-ac 2",
  ])
  .on("error", (err) => {
    console.error(err);
  })
  .output(`output.flv`)
  .run();



    


    It works then

    


    Why doesn't first code work ?

    


  • ffmpeg messes up delayed inputs (repeats at the beginning)

    20 mars 2023, par Ralph

    ffmpeg plays audio inputs delayed to t1, t2 etc at t=0.
If there are several inputs, then it replicates one after the other (after in0 finishes with its duration duration(in0), plays another one at t=duration(in0), etc.)

    


    In the following example, the in0 is played at t=0.

    


    ffmpeg -i in0.mp3 -i in1.mp3 -i in2.mp3 -filter_complex "[0]adelay=1000[delayed1];[1]adelay=2000[delayed2];[2]adelay=3000[delayed3];[delayed1][delayed2][delayed3]amix=inputs=3:duration=longest" -codec:a libmp3lame -q:a 4 output.mp3


    


    The command performs the following : 1. The ffmpeg processes three input files (mp3). 2. The complex filter delays the inputs by 1, 2, 3 seconds input-wise. 3. amix mixes the delayed outputs together. 4. And finally, a coded transforms it into an output mp3.

    


    Another short version : 2 delayed beeps, an finally there come 3 beeps out (@ 0, 1, 2 seconds) :

    


    ffmpeg -i beep.mp3 -filter_complex "[0]adelay=1000[delayed1];[0]adelay=2000[delayed2];[delayed1][delayed2]amix=inputs=2:duration=longest" -codec:a libmp3lame -q:a 4 output.mp3


    


    ffmpeg version N-110011-gf456c192d9-tessus on a Mac M1, downloaded as binary from https://evermeet.cx/ffmpeg (01.2023).

    


    I added also a silent input file from 0 to 1 seconds without any alteration of the outcome.
I added a silent stream as input as well without improvement. E.g. :

    


    ... -filter_complex "aevalsrc=0:d=4[silence];...


    


    Another test with another ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.1.6 (clang-1316.0.21.2.5) :
ffmpeg -i beep.mp3 -filter_complex "[0]adelay=1000[delayed1];aevalsrc=0:d=5[silence];[silence][delayed1]amix=inputs=2:duration=longest" -codec:a libmp3lame -q:a 4 output.mp3
There are again 2 beeps, at 0 and 1 second.

    


    (comment : concat solves the issue. But I want to have a flexible solution with possibly overlapping audio streams.) Thanks for giving a hint !