Recherche avancée

Médias (91)

Autres articles (23)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (7485)

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

    7 mars 2017, 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] http://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.

  • Fluent-ffmpeg Node.js overlay audio

    10 avril 2017, par Dineshkarthik Raveendran

    Using fluent-ffmpeg am trying to merge a set of videos into a single video, which am able to achieve with the following code :

      var ffmpeg = require('fluent-ffmpeg'),
           command = ffmpeg(),
           videoNames = ['video1.mp4', 'video2.mp4', 'video3.mp4'];

       videoNames.forEach(function(videoName){
           command = command.addInput(videoName);
       });
       command.mergeToFile('output.mp4')
       .on('error', function(err) {
           console.log('Error ' + err.message);
       })
       .on('end', function() {
           console.log('Finished!');
       });

    In additon to the above am trying to overlay an audio to the merged video without removing the existing audio. What am trying to do is replicate the following command line using fluent-ffmpeg wrapper

    ffmpeg -i io1.mp4 -i io2.mp4 -i io3.mp4 -i io4.mp4 -i io5.mp4 -i io6.mp4 -i audio.mp3 -filter_complex '[0:a][1:a][2:a][3:a][4:a][5:a]concat=n=7:v=0:a=1,volume=1[aout];[6]volume=0.1[bout];[aout][bout]amerge=[tout];[0:v][1:v][2:v][3:v][4:v][5:v]concat=n=6:v=1:a=0[v1]' -map [v1] -map [tout] -c:a aac -b:a 96K  -shortest -y out.mp4

    Tried the following but unable to implement the filter_complex with streams properly

    var ffmpeg = require('fluent-ffmpeg'),
       command = ffmpeg(),
       videoNames = ['video1.mp4', 'video2.mp4', 'video3.mp4'];

    videoNames.forEach(function(videoName){
       command = command.addInput(videoName);
    });
    command.addInput("myAudio.mp3")
           .audioFilters('volume=0.1'); // trying to overlay new audio without removing existing audio
    command.mergeToFile('output.mp4')
    .on('error', function(err) {
       console.log('Error ' + err.message);
    })
    .on('end', function() {
       console.log('Finished!');
    });

    Which throw the error Error ffmpeg exited with code 1: Cannot find a matching stream for unlabeled input pad 6 on filter Parsed_concat_0

  • avio_open crashes, avcodec_copy_context doesn't work

    5 mars 2017, par Nulano

    I’m trying to port https://ffmpeg.org/doxygen/trunk/doc_2examples_2remuxing_8c-example.html to JavaCPP Presets for FFmpeg https://github.com/bytedeco/javacpp-presets/tree/master/ffmpeg.

    I have this so far :

    av_register_all();

    AVFormatContext inFmtCtx = new AVFormatContext(null);
    if (avformat_open_input(inFmtCtx, "file.ts", null, null) != 0)
       throw new Exception("Could not open input file");
    if (avformat_find_stream_info(inFmtCtx, (PointerPointer)null) != 0)
       throw new Exception("Failed to retrieve input stream information");
    av_dump_format(inFmtCtx, 0, "file.ts", 0);

    AVFormatContext outFmtCtx = new AVFormatContext(null);
    avformat_alloc_output_context2(outFmtCtx, null, null, "file2.ts");
    AVOutputFormat outFmt = outFmtCtx.oformat();
    for (int i = 0; i &lt; inFmtCtx.nb_streams(); i++) {
       AVStream inStr = inFmtCtx.streams(i);
       AVStream outStr = avformat_new_stream(outFmtCtx, inStr.codec().codec());
       if (outStr.isNull()) throw new Exception("Failed allocating output stream");
       if (avcodec_copy_context(outStr.codec(), inStr.codec()) != 0)
           throw new Exception("Failed to copy context from input to"+
                               " output stream codec context");
       if ((outFmtCtx.oformat().flags() &amp; AVFMT_GLOBALHEADER) != 0)
           outStr.codec().flags(outStr.codec().flags() | CODEC_FLAG_GLOBAL_HEADER);
    }
    av_dump_format(outFmtCtx, 0, "file2.ts", 1);

    if ((outFmt.flags() &amp; AVFMT_NOFILE) == 0)
       if (avio_open(outFmtCtx.pb(), "file2.ts", AVIO_FLAG_WRITE) != 0)
           throw new Exception("Could not open output file");

    The problem is, that the avio_open call causes the JVM to crash with an access violation.

    Stack: [0x00000000037e0000,0x00000000038e0000],  sp=0x00000000038df6d0,  free space=1021k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C  [avformat-57.dll+0x28877]
    C  [jniavformat.dll+0x383cb]
    C  0x0000000003bcdfcc

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  org.bytedeco.javacpp.avformat.avio_open(Lorg/bytedeco/javacpp/avformat$AVIOContext;Ljava/lang/String;I)I+0
    j  TestRemuxer.main([Ljava/lang/String;)V+226
    v  ~StubRoutines::call_stub

    This is the output (without the crash message) :

    Input #0, mpegts, from 'file.ts':
     Duration: 00:00:17.60, start: 0.000000, bitrate: 1016 kb/s
     Program 1
       Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 636x480 [SAR 900:901 DAR 45:34], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
       Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 194 kb/s
    Output #0, mpegts, to 'file2.ts':
       Stream #0:0: Unknown: none
       Stream #0:1: Unknown: none

    I suspect the cause of the access violation is the same as what causes the output streams to be unknown. However, if I pause debugging on the second av_dump_format call, I can use Evaluate to verify, that the codecs were copied properly. (I checked the FFmpeg sources, and I know that a stream is dumped as Unknown, if and only if its codec_type is set to an invalid value, however the value is correctly 0 for the first stream and 1 for the second stream.)