Recherche avancée

Médias (91)

Autres articles (80)

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

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (11573)

  • Adding FFMPEG Layer to HLS streaming causes video playback issues

    25 juin 2023, par Moe

    I have been searching a lot about HLS streaming and have succeeded to create a simple HLS streaming server with nodejs, the problem now is I need to add a layer of ffmpeg encoding to the .ts chunks before streaming to the user, without this layer everything works fine and on my server only 3 requests are seen :

    


    manifest.m3u8
output_000.ts
output_000.ts
output_001.ts
output_002.ts


    


    But then when I add a simple ffmpeg layer that literally copies everything from the ts file and output the stream (I will add of course dynamic filters to each request, thats why I need this ffmpeg layer), the player goes insane and request the whole video in just 5 seconds or something :

    


    manifest.m3u8
output_000.ts
output_000.ts
output_001.ts
output_002.ts
output_001.ts
output_003.ts
output_002.ts
...
output_095.ts


    


    I have also notices that the numbers aren't increasing uniformly and suspect this is part of the issue, I have tried adding more ffmpeg options to not do anything to the .ts files that are being fed to it as they are a part of a bigger video.

    


    Here's my NodeJS server (NextJS API route) :

    


    
const fs = require(`fs`);
const path = require(`path`);
const {exec, spawn} = require(`child_process`);
const pathToFfmpeg = require(`ffmpeg-static`);

export default function handler(req, res) {
  
    const { filename } = req.query;
    console.log(filename);
    const filePath = path.join(process.cwd(), 'public', 'stream', `${filename}`);
    const inputStream = fs.createReadStream(filePath);

    // first check if that is ts file..
    if(filename.indexOf(`.ts`) != -1){
  
      const ffmpegProcess = spawn(pathToFfmpeg, [
        '-f', `mpegts`,
        '-i', 'pipe:0', // specify input as pipe
        '-c', 'copy', 
        '-avoid_negative_ts', '0',
        `-map_metadata`, `0`,  // copy without re-encoding
        '-f', 'mpegts', // output format
        'pipe:1'        // specify output as pipe
      ], {
        stdio: ['pipe', 'pipe', 'pipe'] // enable logging by redirecting stderr to stdout
      });
      res.status(200);
      res.setHeader('Content-Type', 'application/vnd.apple.mpegurl');
      res.setHeader('Cache-Control', 'no-cache');
      res.setHeader('Access-Control-Allow-Origin', '*');
 

      // ffmpegProcess.stderr.pipe(process.stdout); // log stderr to stdout
  
      inputStream.pipe(ffmpegProcess.stdin);
      ffmpegProcess.stdout.pipe(res);
  
      ffmpegProcess.on('exit', (code) => {
        if (code !== 0) {
          console.error(`ffmpeg process exited with code ${code}`);
        }
      });
    }else{
      // if not then stream whatever file as it is
      res.status(200);
      res.setHeader('Content-Type', 'application/vnd.apple.mpegurl');
      inputStream.pipe(res);
    }
  }


    


    I have tried to feed the request's player appropriate headers but that didn't work, I have also tried to add the '-re' option to the ffmpeg encoder itself and hoped for minimal performance hits, but that also caused playback issue due to being too slow.

    


  • How to embed an MP4 inside a PDF ?

    19 août 2020, par malat

    I am a happy user of img2pdf. This tool does the minimal amount of work to put a series of JPEG 2000/JPEG/PNG images into a PDF "enveloppe". However I am now faced with a new challenge : embed a MP4 file into a PDF "enveloppe".

    


    I see that commercial tool can do it, as seen at :

    


    


    Here is one such sample PDF file (no Flash required on windows in this sample) :

    


    


    It seems to have been introduced in ISO 32000-1 (PDF 1.7 Extension Level 5)

    


    I am looking for a solution which will use the Rich Media annotation inside the PDF stream.

    


    There are dozen of duplicated questions on superuser/stackoverflow, which all pretty much refer to imagemagick/convert command line tool. But in my case, convert expand the images into a multi-page PDF (which is not my desired behavior) :

    


    $ convert input.mp4 output.pdf
$ pdfinfo output.pdf 
Title:          out
Producer:       https://imagemagick.org
CreationDate:   Wed Aug 19 15:38:01 2020 CEST
ModDate:        Wed Aug 19 15:38:01 2020 CEST
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          1601
Encrypted:      no
Page size:      352 x 288 pts
Page rot:       0
File size:      534407296 bytes
Optimized:      no
PDF version:    1.3


    


    with :

    


    $ convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib


    


    and

    


    $ file input.mp4 
input.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]
$ ffprobe -v quiet -print_format json  -show_streams input.mp4 | grep codec_long_name
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",


    


  • OpenCV VideoWriter will not open

    21 février 2015, par ChrisC

    I’m having trouble instantiating and opening an OpenCV VideoWriter for recording video on a Raspberry Pi (Raspbian Weezy).

    My project is written in C++, but I’ve written a minimal Python program that demonstrates the problem.

    https://gist.github.com/chriscollins/11ff2f43852e1c93dae8

    Both my C++ code and the Python code above run without problem on my Windows machine. Sometimes the writer does not open, but that’s to be expected - I don’t have all of the listed codecs installed (the list of codecs comes from the Open CV source), but a good number of them work correctly. However, on a Raspberry Pi, both the C++ code and the Python code fail with the VideoWriter never being opened. In the above Python code, writer.isOpened() returns false for every single codec, when run on a Raspberry Pi.

    I’ve chowned the destination directory to the user I’m running the Python script as, and chmodded it to 777 so I don’t believe that it is a permissions problem. I think it may be connected with how I’ve installed OpenCV or some of its dependencies, but I’m not sure how to rectify it.

    The install process I’ve used is as follows :

    1. Update firmware/packages via rpi-update, apt-get update and apt-get upgrade.

    2. Install the following dependencies via apt-get :

      libjpeg8
      libjpeg8-dev
      libjpeg8-dbg
      libjpeg-progs
      ffmpeg
      libavcodec-dev
      libavcodec53
      libavformat53
      libavformat-dev
      libgstreamer0.10-0-dbg
      libgstreamer0.10-0
      libgstreamer0.10-dev
      libxine1-ffmpeg
      libxine-dev
      libxine1-bin
      libunicap2
      libunicap2-dev
      swig
      libv4l-0
      libv4l-dev
      python-numpy
      libpython2.6
      python-dev
      python2.6-dev
      libgtk2.0-dev
    3. Download and unzip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip to /root/opencv-2.4.9.

    4. cd /root/opencv-2.4.9 and run cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF. Output of cmake is available at https://gist.github.com/chriscollins/d8060e03a6acd6d4336c

    5. make and make install from the same directory.

    Various other OpenCV functionality works correctly on the Raspberry Pi (in C++ or in Python) - e.g. viewing a webcam via VideoCapture, but I can’t get the VideoWriter to work. I’m tempted to try installing FFMPEG from source instead of via apt-get, but as make takes 5+ hours to run on a Raspberry Pi, I was hoping I’d find the answer here, rather than proceeding with a trial and error approach !

    Any advice on how to solve (or debug) this is appreciated.

    EDIT : Added output of cmake command (https://gist.github.com/chriscollins/d8060e03a6acd6d4336c)