Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (8)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

Sur d’autres sites (2861)

  • on('progress') not working - node.js ytdl-core fluent-ffmpeg

    9 juillet 2018, par TheBandolero

    So i’m playing with this libraries ytdl-core and fluent-ffmpeg, and basically i got to this function by modifying some examples to fit what i wanted.

    everything works fine except for the second on('progress', progress => ....) call. The first one works as expected, but the second one looks like it isn’t even reached, since Console.log() inside the second on('progress'....) isn’t logging anything at all.

    Also console doesn’t show any errors throughout the whole function, and the outcome is the expected without any problem, except for the second on('progress') issue.

    I can’t figure out what the problem is, so I hope somebody with more experience can point the problem out to me, since it’s getting quite frustrating now...

    function descargarVideoHD(link) {
           ytdl.getInfo(link, (err, info) => {
               if (err) throw err;

               $('li:contains(' + link + ') .progress').css("visibility", "visible");

               var longitudEnTiempo = parseInt(info.length_seconds);
               let id = ytdl.getURLVideoID(link);
               var titulo = limpiarTituloDelVideo(info.title);

               let stream = ytdl(id, {
                   quality: 'highestaudio',
                   //filter: 'audioonly',
               });

               //var audioOutput = path.resolve(__dirname, 'audio_' + titulo + '.mp4');
               var mainOutput = path.resolve(__dirname, titulo + '.mp4');
               var renameFileName = titulo + '.mp4';

               var audioOutput = path.resolve(__dirname, titulo + '.mp3');

               ffmpeg(stream)
                   //.audioBitrate(128)
                   .audioBitrate(256)
                   .save(`${__dirname}/${titulo}.mp3`)
                   .on('progress', (p) => {
                       //readline.cursorTo(process.stdout, 0);
                       //process.stdout.write(`${p.targetSize}kb downloaded`);
                       var hmsA = p.timemark;
                       var aA = hmsA.split(':');
                       var secondsA = parseInt((+aA[0]) * 60 * 60 + (+aA[1]) * 60 + (+aA[2]));
                       var porcentageA = (((secondsA / longitudEnTiempo) * 100) / 2).toFixed(2);
                       $('li:contains(' + link + ') .progress .determinate').css("width", porcentageA + "%");
                       //console.log(titulo + ' procesado al ' + porcentage + '%');
                   })
                   .on('end', () => {
                       ffmpeg()
                           .input(ytdl(link, {
                               filter: format => {
                                   return format.container === 'mp4' && !format.audioEncoding;
                               }
                           }))
                           .videoCodec('copy')
                           .input(audioOutput)
                           .audioCodec('copy')
                           .save(mainOutput)
                           .on('error', console.error)
                           .on('progress', progress => {
                               console.log('Dentro de OnProgress...');
                               var hms = progress.timemark;
                               console.log('Timemark: ' + hms);
                               var a = hms.split(':');
                               var seconds = parseInt((+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]));
                               console.log('Segundos: ' + seconds);
                               var porcentage = ((((seconds / longitudEnTiempo) * 100) / 2) + 50).toFixed(2);
                               console.log('Procesado al ' + porcentage + '%');
                               $('li:contains(' + link + ') .progress .determinate').css("width", porcentage + "%");
                           }).on('end', () => {
                               fs.unlink(audioOutput, err => {
                                   if (err) {
                                       console.error(err);
                                   }
                                   else {
                                       $('li:contains(' + link + ') .progress .determinate').css("width", "100%");
                                       $('li:contains(' + link + ') .secondary-content.material-icons').text('done');
                                       $('li:contains(' + link + ') .secondary-content.material-icons').addClass('text-green');
                                       /* $('li:contains(' + link + ')').remove();
                                       var indexItem = listaEnlacesYoutube.indexOf(link);
                                       listaEnlacesYoutube.splice(indexItem, 1); */
                                   }
                               });
                           });
                   });
           });
       }
  • libmp3lame ignore ffmpeg options, and can not change audio bitrate

    27 août 2018, par Ahmed

    i have java application to encode audio and send it via socket to server, i use ffmpeg to get compressed avpacket then send this packet via socket , the problem is the bandwidth is large than what is want, and can not control it, i try to set bitrate option to encoder (libmp3lame) but it’s ignore it completely, and i don not know is the problem from code or because i did not use ffmpeg libformat to send the packet to socket ?

    this how i open a codec

          codec = avcodec_find_encoder_by_name("libmp3lame");
           //codec = avcodec_find_encoder(AV_CODEC_ID_MP3);

           if(codec == null)
               throw new Exception("Codec not found");

           context = avcodec_alloc_context3(codec);

           if(context == null)
               throw new Exception("Could not allocate audio codec context");

           context.codec_tag(0);
           context.codec_id(AV_CODEC_ID_MP3);
           context.codec_type(AVMEDIA_TYPE_AUDIO);

           // set sample parameter
           context.bit_rate(audio_bitrate);
           context.sample_rate(samples_rate);
           context.channels(samples_channels);
           context.channel_layout(av_get_default_channel_layout(samples_channels));
           context.time_base().num(1).den(samples_rate);

           context.sample_fmt(AV_SAMPLE_FMT_S16);
           context.bits_per_raw_sample(16);        

           context.flags(context.flags() | AV_CODEC_FLAG_QSCALE);
           context.global_quality((int)Math.round(FF_QP2LAMBDA * audioQuality));

           if ((codec.capabilities() & AV_CODEC_CAP_EXPERIMENTAL) != 0) {
               context.strict_std_compliance(AVCodecContext.FF_COMPLIANCE_EXPERIMENTAL);
           }

           // priv_data()
           av_opt_set(context.priv_data() , "crf" , audioQuality + "" , 0);
           av_opt_set(context.priv_data() , "b" , "85" , 0);
           //av_opt_set(context.priv_data() , "V" , "2" , 0);
           //av_opt_set(context.priv_data() , "lowpass" , "120" , 0);
           av_opt_set(context.priv_data() , "abr" , "1" , 0);

           AVDictionary options = new AVDictionary(null);
           //av_dict_set(options, "crf", ""+audioQuality , 0);
           av_dict_set(options, "b:a", "8k" , 0);
           av_dict_set(options , "q:a" , "8" , 0);
           //av_dict_set(options , "lowpass" , "19.5" , 0);
           //av_dict_set(options, "b" , "8K" , 0);


           // open codec
           if (avcodec_open2(context, codec, (PointerPointer)null ) < 0)
               throw new Exception("Could not open codec");
    ....
  • ValueError : I/O operation on closed file when making animation

    3 juillet 2018, par user3851187

    I am using matplotlib and ffmpeg to do some animations. I usually code on a remote server because the code runs faster ; we are having some issues making animations on the remote server. Here is an example of code that works perfectly on my local mac but does not work remotely.

    import matplotlib as mpl
    mpl.use('agg')
    import matplotlib as mpl
    from matplotlib import animation
    import pylab

    def init():
       pylab.plot(pylab.arange(10), [0]*10)

    def redraw(frame):
       pylab.plot(pylab.arange(10), pylab.arange(10) * frame)

    fig = pylab.figure()
    ani = animation.FuncAnimation(fig, redraw, frames=10, interval=1000, init_func=init)
    ani.save('animation.mp4')

    I get the animation I want on my local machine (macOS Sierra). When I run it on the remote host (Debian GNU/Linux 8 (jessie)), I get the following error message after 5 frames

    Traceback (most recent call last):
     File "animation.py", line 14, in <module>
       ani.save('animation.mp4')
     File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 1200, in save
       writer.grab_frame(**savefig_kwargs)
     File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
       self.gen.throw(type, value, traceback)
     File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 241, in saving
       self.finish()
     File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 367, in finish
       self.cleanup()
     File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 405, in cleanup
       out, err = self._proc.communicate()
     File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 724, in communicate
       stdout, stderr = self._communicate(input, endtime, timeout)
     File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1535, in _communicate
       orig_timeout)
     File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1591, in _communicate_with_poll
       register_and_append(self.stdout, select_POLLIN_POLLPRI)
     File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1570, in register_and_append
       poller.register(file_obj.fileno(), eventmask)
    ValueError: I/O operation on closed file
    </module>

    My local machine uses matplotlib version 2.0.0 ; the remote machine uses matplotlib version 2.2.2

    On my local machine I have ffmpeg version 3.2.4

    $ ffmpeg -version
    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
    built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared -
    -enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
    --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
    libavutil      55. 34.101 / 55. 34.101
    libavcodec     57. 64.101 / 57. 64.101
    libavformat    57. 56.101 / 57. 56.101
    libavdevice    57.  1.100 / 57.  1.100
    libavfilter     6. 65.100 /  6. 65.100
    libavresample   3.  1.  0 /  3.  1.  0
    libswscale      4.  2.100 /  4.  2.100
    libswresample   2.  3.100 /  2.  3.100
    libpostproc    54.  1.100 / 54.  1.100

    On the remote host i have ffmpeg version 4.0.1

    ffmpeg -version
    ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 4.9.2 (Debian 4.9.2-10+deb8u1)
    configuration: --prefix=/usr/local
    libavutil      56. 14.100 / 56. 14.100
    libavcodec     58. 18.100 / 58. 18.100
    libavformat    58. 12.100 / 58. 12.100
    libavdevice    58.  3.100 / 58.  3.100
    libavfilter     7. 16.100 /  7. 16.100
    libswscale      5.  1.100 /  5.  1.100
    libswresample   3.  1.100 /  3.  1.100

    If I recall correctly I installed ffmpeg locally through homebrew ; I have the anaconda distribution of python. On the remote machine we have the default version of python that comes with Jessie ; I’m not sure how the sysadmin installed ffmpeg.

    I am by no means an expert on ffmpeg, but I have generally never had issues with making animations in matplotlib on my local machine and I would really like to be able to make videos more quickly on the remote machine. Any help would be appreciated !

    Edit
    On the remote machine, the animation works if I use avconv as the writer instead of ffmpeg. I installed avconv locally...which led me to get the same ffmpeg issues locally (probably due to updating shared dependencies). However, I uninstalled ffmpeg and reinstalled it with x264 codec enables Animations in ipython (jupyter) notebook - ValueError : I/O operation on closed file