Recherche avancée

Médias (91)

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 ;

  • 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

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (10333)

  • Split a movie into 1000+ shots using PyAV in a single pass ?

    3 mai 2019, par Andrew Klaassen

    I need to split a 44 minute MP4 into 1000 shots (i.e. separate MP4s) with ffmpeg. I want to do it quickly (i.e. in a single pass rather than 1000 passes), I need perfect frame accuracy, and I need to do it in Windows.

    The Windows command-line length limit is stopping me from doing this, and I’m wondering if someone could show me an example of how to do this using a library like PyAV or Avpy. (Libraries like ffmpeg-python and ffmpy won’t help, since they simply construct an ffmpeg command line and run it, leading to the same Windows command-line length issue that I already have.)

    After much testing and gnashing of teeth, I’ve learned that the only way to get perfect frame accuracy from ffmpeg, 100% of the time, is to use the "select" filter. ("-ss" in the newest versions of ffmpeg is frame accurate 99% of the time ; unfortunately, that’s not good enough for this application.)

    There are two ways to use "select" for this. There’s the slow way, which I’m doing now, and which requires having ffmpeg open the file 1000 times :

    for (start, end, name) in shots:
       audio_start = start / frame_rate
       audio_end = end + 1 / frame_rate
       cmd = [
           path_to_ffmpeg,
           '-y',
           '-i', input_movie,
           '-vf', r'select=between(n\,%s\,%s),setpts=PTS-STARTPTS' % (start, end),
           '-af', 'atrim=%s:%s,asetpts=PTS-STARTPTS' % (audio_start, audio_end),
           '-c:v', 'libx264',
           '-c:a', 'aac',
           '-write_tmcd', '0',
           '-g', '1',
           '-r', str(frame_rate),
           name + '.mp4',
           '-af', 'atrim=%s:%s' % (audio_start, audio_end),
           name + '.wav',
       ]
       subprocess.call(cmd)

    And there’s the fast way, which causes the Windows command line to explode when there are too many shots. The long command line leads to a failure to run :

    cmd = [
       path_to_ffmpeg,
       '-y',
       '-i',
       input_movie,
    ]
    for (start, end, name) in shots:
       audio_start = start / frame_rate
       audio_end = end + 1 / frame_rate
       cmd.extend([
           '-vf', r'select=between(n\,%s\,%s),setpts=PTS-STARTPTS' % (start, end),
           '-af', 'atrim=%s:%s,asetpts=PTS-STARTPTS' % (audio_start, audio_end),
           '-c:v', 'libx264',
           '-c:a', 'aac',
           '-write_tmcd', '0',
           '-g', '1',
           '-r', str(frame_rate),
           name + '.mp4',
           '-af', 'atrim=%s:%s' % (audio_start, audio_end),
           name + '.wav',
       ]
    subprocess.call(cmd)

    I’ve looked through the documentation of PyAV and Avpy, but I haven’t been able to figure out whether the second form of my function is something I could do there, or how I’d go about doing it. If it is possible, would someone be able to write a function equivalent to my second function, using either library ?

  • Node.js seek wav audio file with ffmpeg

    3 mai 2019, par loretoparisi

    I’m using ffprobe to seek to position on mp3 files, and it works ok. This is how I do in my ffprobe node.js wrapper :

    seek = function (fpath, seconds) {
         var self = this;
         return new Promise((resolve, reject) => {
           //ffprobe -i /myfile.mp3 -show_frames -show_entries frame=pkt_pos -of default=noprint_wrappers=1:nokey=1 -hide_banner -loglevel panic -read_intervals 20%+#1
           var loglevel = self.logger.isDebug() ? 'debug' : 'panic';
           const args = [
             '-hide_banner',
             '-loglevel', loglevel,
             '-show_frames',//Display information about each frame
             '-show_entries', 'frame=pkt_pos',// Display only information about byte position
             '-of', 'default=noprint_wrappers=1:nokey=1',//Don't want to print the key and the section header and footer
             '-read_intervals', seconds + '%+#1', //Read only 1 packet after seeking to position 01:23
             '-print_format', 'json',
             '-v', 'quiet',
             '-i', fpath
           ];
           const opts = {
             cwd: self._options.tempDir
           };
           const cb = (error, stdout) => {
             if (error)
               return reject(error);
             try {
               const outputObj = JSON.parse(stdout);
               return resolve(outputObj);
             } catch (ex) {
               self.logger.error("seek failed %s", ex);
               return reject(ex);
             }
           };
           cp.execFile('ffprobe', args, opts, cb)
             .on('error', reject);
         });
       }//seek

    So to seek to a specified startTime position in seconds you do

    seek(path,startTime)

    and then you will get the equivalent in bytes looking at the packet of the first frames in frames like :

    position  = function() {
         if(this.raw.frames) {
           if(this.raw.frames.length>0) {// get first stream ref
             if(this.raw.frames[0].pkt_pos) {// get first stream ref
               return this.raw.frames[0].pkt_pos;
             }
           }
         }
         return '';
       }//position

    So, when doing seek on a mp3 file it works ok and the range query is

    rangeBytes bytes=80685-8000685 {
     "url": "",
     "path": "",
     "raw": {
       "frames": [
         {
           "pkt_pos": "80685"
         }
       ]
     }
    } {
     "url": "",
     "path": "",
     "raw": {
       "frames": [
         {
           "pkt_pos": "8000685"
         }
       ]
     }
    }

    the problem is that when I use this on a wave file, the resulting range query for the wave file :

    rangeBytes bytes=768058-76800058 {
     "url": "",
     "path": "",
     "raw": {
       "frames": [
         {
           "pkt_pos": "768058"
         }
       ]
     }
    } {
     "url": "",
     "path": "",
     "raw": {
       "frames": [
         {
           "pkt_pos": "76800058"
         }
       ]
     }
    }

    will not work in the standard HTML5 audio player.

    NOTE
    The ffprobe command line command that I’m using with the wrapper above was :

    ffprobe -i /myfile.mp3 -show_frames -show_entries frame=pkt_pos -of default=noprint_wrappers=1:nokey=1 -hide_banner -loglevel panic -read_intervals 20%+#1

    my guess is if this applies to both mp3 and wave files.

  • avformat/matroskaenc : Simplify check for writing CRCs

    20 avril 2019, par Andreas Rheinhardt
    avformat/matroskaenc : Simplify check for writing CRCs
    

    Up until now, the check for whether to write CRC32 elements was always
    mkv->write_crc && mkv->mode != MODE_WEBM. This is equivalent to simply
    set write_crc to zero in WebM-mode. And this is what this commit does.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] libavformat/matroskaenc.c