Recherche avancée

Médias (91)

Autres articles (40)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • 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" ;

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (6349)

  • How do I properly enable ffmpeg for matplotlib.animation ?

    9 novembre 2018, par spanishgum

    I have covered a lot of ground on stack so far trying to get ffmpeg going so I can make a timelapse video.

    I am on a CentOS 7 machine, running python3.7.0a0.

    python3
    >>> import numpy as np
    >>> np.__version__
    '1.12.0'
    >>> import matplotlib as mpl
    >>> mpl.__version__
    '2.0.0'
    >>> import mpl_toolkits.basemap as base
    >>> base.__version__
    '1.0.7'

    I found this github gist on installing ffmpeg. I used the chromium source, and installed without a prefix option (using the default).

    I have confirmed that ffmpeg is installed, although I don’t know anything about testing whether it works.

    which ffmpeg
    /usr/local/bin/ffmpeg

    ffmpeg -version
    ffmpeg version N-83533-gada281d Copyright (c) 2000-2017 the FFmpeg dev elopers
    built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11
    configuration:
    libavutil      55. 47.100 / 55. 47.100
    libavcodec     57. 80.100 / 57. 80.100
    libavformat    57. 66.102 / 57. 66.102
    libavdevice    57.  2.100 / 57.  2.100
    libavfilter     6. 73.100 /  6. 73.100
    libswscale      4.  3.101 /  4.  3.101
    libswresample   2.  4.100 /  2.  4.100

    I tried to run a few sample examples I found online :

    [1] http://matplotlib.org/examples/animation/basic_example_writer.html

    [2] https://stackoverflow.com/a/23098090/3454650

    Everything works fine up until I try to save the animation file.

    [1]

    anim.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])

    [2]

    im_ani.save('im.mp4', writer=writer)

    I found here that explictly setting the path to ffmpeg might be necessary so I added this to the top of the test scripts :

    plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'

    I tried a few more tweaks in the code but always get the same response, which I do not know how to begin deciphering :

    Traceback (most recent call last):
     File "testanim.py", line 27, in <module>
       writer.grab_frame()
     File "/usr/local/lib/python3.7/contextlib.py", line 100, in __exit__
       self.gen.throw(type, value, traceback)
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 256, in saving
       self.finish()
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 276, in finish
       self.cleanup()
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 311, in cleanup
       out, err = self._proc.communicate()
     File "/usr/local/lib/python3.7/subprocess.py", line 836, in communicate
       stdout, stderr = self._communicate(input, endtime, timeout)
     File "/usr/local/lib/python3.7/subprocess.py", line 1474, in _communicate
       selector.register(self.stdout, selectors.EVENT_READ)
     File "/usr/local/lib/python3.7/selectors.py", line 351, in register
       key = super().register(fileobj, events, data)
     File "/usr/local/lib/python3.7/selectors.py", line 237, in register
       key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
     File "/usr/local/lib/python3.7/selectors.py", line 224, in _fileobj_lookup
       return _fileobj_to_fd(fileobj)
     File "/usr/local/lib/python3.7/selectors.py", line 39, in _fileobj_to_fd
       "{!r}".format(fileobj)) from None
    ValueError: Invalid file object: &lt;_io.BufferedReader name=6>
    </module>

    Is there something with my configuration that is malformed ? I searched google for this error for some time but never found anything relevant to animations / ffmpeg. Any help would be greatly appreciated.


    UPDATE :

    @LordNeckBeard pointed me here : https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

    I ran into problems with installing the x264 encoding dependency. Some files in libavcodec/*.c (in the make output) were reporting undefined references to several functions. After a wild goose chase found this : https://mailman.videolan.org/pipermail/x264-devel/2015-February/010971.html

    To fix the x264 installation, I simply added some configure flags :

    ./configure --enable-static --enable-shared --extra-ldflags="-lswresample -llzma"

    UPDATE :

    So everything installed fine after fixing the libx264 problems. I went ahead and copied the ffmpeg binary from the ffmpeg_build folder into /usr/local/bin/ffmpeg.

    After running the script I was getting problems where ffmpeg could not find the libx264 shared object. I think I will have to recompile everything using different prefixes. My intuition tells me there are old files laying around after I have messed with everything, using some configuration that is broken.

    So I decided maybe I should just try to use NUX : http://linoxide.com/linux-how-to/install-ffmpeg-centos-7/
    I installed ffmpeg using the new rpm, but to no avail. I still was not able to run ffmpeg because of a missing shared object.

    Finally, instead of usiong files copied into my /usr/local/bin folder, I ran ffmpeg directly from the build bin directory. Turns out that this does work properly !

    So in essence, if I want to install ffmpeg system wide, I need to manually compile from sources again but using a nonlocal prefix.

  • (ffmpeg.autogen)How can i Play RTSP Stream Audio With Video

    1er octobre 2018, par newbie

    I am making rtsp stream player to use opencv..

    The example Project is wonderful.

    But that is with not Sound

    I Added thid Code and I think I found Audio Stream Number, but I don’t know next step

       private readonly AVCodecContext* _aCodecContext;
       private readonly AVFormatContext* _aFormatContext;
       private readonly int _a_streamIndex;

       public VideoStreamDecoder(string url)
       {
           _vFormatContext = ffmpeg.avformat_alloc_context();

           var pFormatContext = _vFormatContext;
           ffmpeg.avformat_open_input(&amp;pFormatContext, url, null, null).ThrowExceptionIfError();

           ffmpeg.avformat_find_stream_info(_vFormatContext, null).ThrowExceptionIfError();

           // find the first video stream
           AVStream* vStream = null;
           for (var i = 0; i &lt; _vFormatContext->nb_streams; i++)
               if (_vFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO)
               {
                   vStream = _vFormatContext->streams[i];
                   break;
               }

           // find Audio stream
           AVStream* aStream = null;
           for (var i = 0; i &lt; _vFormatContext->nb_streams; i++)
               if (_vFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_AUDIO)
               {
                   aStream = _vFormatContext->streams[i];
                   break;
               }

           if (vStream == null) throw new InvalidOperationException("Could not found video stream.");

           _v_streamIndex = vStream->index;
           _vCodecContext = vStream->codec;

           _a_streamIndex = aStream->index;
           _aCodecContext = aStream->codec;

           var vcodecId = _vCodecContext->codec_id;
           var vCodec = ffmpeg.avcodec_find_decoder(vcodecId);

           var acodecId = _aCodecContext->codec_id;
           var aCodec = ffmpeg.avcodec_find_decoder(acodecId);

           if (vCodec == null) throw new InvalidOperationException("Unsupported codec.");

           ffmpeg.avcodec_open2(_vCodecContext, vCodec, null).ThrowExceptionIfError();
           ffmpeg.avcodec_open2(_aCodecContext, aCodec, null).ThrowExceptionIfError();

           vCodecName = ffmpeg.avcodec_get_name(vcodecId);
           aCodecName = ffmpeg.avcodec_get_name(acodecId);
           FrameSize = new Size(_vCodecContext->width, _vCodecContext->height);
           PixelFormat = _vCodecContext->pix_fmt;

           _pPacket = ffmpeg.av_packet_alloc();
           _pFrame = ffmpeg.av_frame_alloc();
       }
  • 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' &amp;&amp; !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); */
                                   }
                               });
                           });
                   });
           });
       }