Recherche avancée

Médias (91)

Autres articles (40)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

Sur d’autres sites (3536)

  • FFMPEG CPU encoding speed

    22 janvier 2020, par natloz

    I would like to increase the speed of encoding videos. Thou having issue with it...

    This is my CPU : Intel(R) Xeon(R) CPU E5-2603 v4 @ 1.70GHz
    OS : Windows 10 PRO 64bit

    I don’t have a graphics card.

    This is the script I’m using for current video encoding :

    ffmpeg -y -re -i o.mov -vf subtitles=SUBS.srt -s 1920x1080 -r 25 -pixel_format yuv420p -aspect 16:9 -top 1 -qp 0 -c:v libx264 -b:v 600000 -minrate 600000 -maxrate 600000 -x264opts bitrate=6000:vbv-maxrate=6000:vbv-bufsize=400:ratetol=400:bitrate=6000:vbv-init=800:force-cfr=1 -g 33 -bf 3 -muxrate 6.5M -flags cgop+ilme+ildct -c:a mp2 -ac 2 -ar 48k -b:a 192k -f mpegts out.mpeg

    The current speed I’m getting is : speed = 1x.

    How can I force my CPU to work at full speed ?

  • Python : mp3 to alsaaudio through ffmpeg pipe and wave.open(f,'r')

    3 juillet 2017, par user2754098

    I’m trying to decode mp3 to wav using ffmpeg :

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('filename.mp3', 'rb') as infile:
       p=Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-'], stdin=infile, stdout=PIPE)
       ...

    Next i want redirect data from p.stdout.read() to wave.open(file, r) to use readframes(n) and other methods. But i cannot because ’file’ in wave.open(file,’r’) can be only name of file or an open file pointer.

       ...
       file = wave.open(p.stdout.read(),'r')
       card='default'
       device=alsaaudio.PCM(card=card)
       device.setchannels(file.getnchannels())
       device.setrate(file.getframerate())
       device.setformat(alsaaudio.PCM_FORMAT_S16_LE)
       device.setsetperiodsize(320)
       data = file.readframes(320)
       while data:
           device.write(data)
           data = file.readframes(320)

    I got :

    TypeError: file() argument 1 must be encoded string without NULL bytes, not str

    So is it possible to handle data from p.stdout.read() by wave.open() ?
    Making temporary .wav file isn’t solution.

    Sorry for my english.
    Thanks.

    UPDATE

    Thanks to PM 2Ring for hit about io.BytesIO.

    However resulting code does not work.

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('sometrack.mp3', 'rb') as infile:
           p=Popen(['ffmpeg', '-i', '-', '-f','wav', '-'], stdin=infile , stdout=PIPE , stderr=PIPE)
           fobj = io.BytesIO(p.stdout.read())
    fwave = wave.open(fobj, 'rb')

    Trace :

    File "./script.py", line x, in <module>
     fwave = wave.open(fobj, 'rb')
    File "/usr/lib/python2.7/wave.py", line x, in open
     return Wave_read(f)
    File "/usr/lib/python2.7/wave.py", line x, in __init__
     self.initfp(f)
    File "/usr/lib/python2.7/wave.py", line x, in initfp
     raise Error, 'not a WAVE file'
    wave.Error: not a WAVE file
    </module>

    From /usr/lib/python2.7/wave.py :

    ...
    self._file = Chunk(file, bigendian = 0)
    if self._file.getname() != 'RIFF':
       raise Error, 'file does not start with RIFF id'
    if self._file.read(4) != 'WAVE':
       raise Error, 'not a WAVE file'
    ...

    Checking has been failed due to ’bad’ self._file object.

    Inside /usr/lib/python2.7/chunk.py i have found a source of problem :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Because struct.unpack(strflag+’L’, file.read(4))[0] returns 0.
    But this function works correct.

    As specified here :

    "5-8 bytes - File size(integer)
    Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you’d fill this in after creation."
    That’s why my script doesn’t work. wave.open and other functions cannot handle my file object because self.chunksize = 0. Looks like ffmpeg cannot insert File size when using PIPE.

    SOLUTION

    It’s simple.
    I’ve changed init function of Chunk class :

    After :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Before :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
       currtell = file.tell()
       if self.chunksize == 0:
           file.seek(0)
           file.read(currtell)
           self.chunksize = len(file.read())-4
           file.seek(0)
           file.read(currtell)
    except struct.error:
       raise EOFError
    ...

    Of course editing of original module is bad idia. So I’ve create custom forks for 2 classes Chunk and Wave_read.

    Working but unstable full code you can find here.

    Sorry for my awful english.

    Thanks.

  • Python : mp3 to alsaaudio through ffmpeg pipe and wave.open(f,'r')

    16 avril 2015, par user2754098

    I’m trying to decode mp3 to wav using ffmpeg :

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('filename.mp3', 'rb') as infile:
       p=Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-'], stdin=infile, stdout=PIPE)
       ...

    Next i want redirect data from p.stdout.read() to wave.open(file, r) to use readframes(n) and other methods. But i cannot because ’file’ in wave.open(file,’r’) can be only name of file or an open file pointer.

       ...
       file = wave.open(p.stdout.read(),'r')
       card='default'
       device=alsaaudio.PCM(card=card)
       device.setchannels(file.getnchannels())
       device.setrate(file.getframerate())
       device.setformat(alsaaudio.PCM_FORMAT_S16_LE)
       device.setsetperiodsize(320)
       data = file.readframes(320)
       while data:
           device.write(data)
           data = file.readframes(320)

    I got :

    TypeError: file() argument 1 must be encoded string without NULL bytes, not str

    So is it possible to handle data from p.stdout.read() by wave.open() ?
    Making temporary .wav file isn’t solution.

    Sorry for my english.
    Thanks.

    UPDATE

    Thanks to PM 2Ring for hit about io.BytesIO.

    However resulting code does not work.

    import alsaaudio
    import wave
    from subprocess import Popen, PIPE

    with open('sometrack.mp3', 'rb') as infile:
           p=Popen(['ffmpeg', '-i', '-', '-f','wav', '-'], stdin=infile , stdout=PIPE , stderr=PIPE)
           fobj = io.BytesIO(p.stdout.read())
    fwave = wave.open(fobj, 'rb')

    Trace :

    File "./script.py", line x, in <module>
     fwave = wave.open(fobj, 'rb')
    File "/usr/lib/python2.7/wave.py", line x, in open
     return Wave_read(f)
    File "/usr/lib/python2.7/wave.py", line x, in __init__
     self.initfp(f)
    File "/usr/lib/python2.7/wave.py", line x, in initfp
     raise Error, 'not a WAVE file'
    wave.Error: not a WAVE file
    </module>

    From /usr/lib/python2.7/wave.py :

    ...
    self._file = Chunk(file, bigendian = 0)
    if self._file.getname() != 'RIFF':
       raise Error, 'file does not start with RIFF id'
    if self._file.read(4) != 'WAVE':
       raise Error, 'not a WAVE file'
    ...

    Checking has been failed due to ’bad’ self._file object.

    Inside /usr/lib/python2.7/chunk.py i have found a source of problem :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Because struct.unpack(strflag+’L’, file.read(4))[0] returns 0.
    But this function works correct.

    As specified here :

    "5-8 bytes - File size(integer)
    Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you’d fill this in after creation."
    That’s why my script doesn’t work. wave.open and other functions cannot handle my file object because self.chunksize = 0. Looks like ffmpeg cannot insert File size when using PIPE.

    SOLUTION

    It’s simple.
    I’ve changed init function of Chunk class :

    After :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
    except struct.error:
       raise EOFError
    ...

    Before :

    ...
    try:
       self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
       currtell = file.tell()
       if self.chunksize == 0:
           file.seek(0)
           file.read(currtell)
           self.chunksize = len(file.read())-4
           file.seek(0)
           file.read(currtell)
    except struct.error:
       raise EOFError
    ...

    Of course editing of original module is bad idia. So I’ve create custom forks for 2 classes Chunk and Wave_read.

    Working but unstable full code you can find here.

    Sorry for my awful english.

    Thanks.