Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (49)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • 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 (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (5939)

  • How can I open a program using PYTHON with Mutliprocessing, and send it strings from the main process ?

    12 février 2018, par Just Askin

    I have a program that sends frames as strings to FFMPEG using something similar to :

    Working script that streams without using multiprocessing module currently on Ubuntu

    #!/usr/bin/python
    import sys, os
    import subprocess as sp
    import pygame
    from pygame.locals import QUIT, KEYUP, K_ESCAPE
    import pygame.display

    pygame.init()
    os.environ['SDL_VIDEODRIVER'] = 'dummy'
    pygame.display.init()
    Display_Surface = pygame.display.set_mode([1280,720], 0, 32)

    # FFMPEG command and settings
    command = ['ffmpeg', '-framerate', '25', '-s', '1280x720', '-pix_fmt', 'rgba', '-f', 'rawvideo', '-i', '-',
              '-f', 'lavfi', '-i', 'anullsrc=cl=mono',
              '-pix_fmt', 'yuv420p','-s', 'hd720', '-r', '25', '-g', '50',
              '-f', 'flv', 'rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx']

    pipe = sp.Popen(command, bufsize=0, stdin=sp.PIPE)

    while True:
       # Quit event handling
       for event in pygame.event.get():
           if event.type == QUIT or (event.type == KEYUP and event.key == K_ESCAPE):
               pygame.quit()
               sys.exit()

       pipe.stdin.write(pygame.image.tostring(Display_Surface, "RGBA"))

    pipe.stdin.close()
    pygame.display.quit()
    os._exit()

    This works fine, except for the fact that it is killing my CPU, which in turn causes my live stream to freeze often. The stupid GIL won’t let FFMPEG run on another CPU/Core while I have 3 perfectly good cores doing nothing.

    I just whipped up some code to open FFMPEG in another process. (By the way, I’m familiar with threading.Thread, but not Multiprocessing).

    import os
    import subprocess as sp
    import multiprocessing

    class FFMPEG_Consumer():

       def __init__(self):
           proc = multiprocessing.Process(target=self.start_ffmpeg)
           proc.start()

       def start_ffmpeg(self):
           command = ['ffmpeg','-pix_fmt', 'rgba', '-f', 'rawvideo', '-i', '-',
                      '-f, 'lavfi', '-i', 'anullsrc=channel_layout=stereo:sample_rate=44100',
                      '-pix_fmt', 'yuv420p','-s', 'hd720', '-f', 'flv', 'rtmp://example.com']

           pipe = sp.Popen(command, bufsize=-1, stdin=sp.PIPE)

       def send_down_the_pipe(self, frame):
           pipe.stdin.write(frame)

    ffmpeg = FFMPEG_Consumer()

    For anyone that knows how to use multiprocessing, I’m sure you will immediately see that this does not work because I can’t share variables this way across processes. But, it does open FFMPEG on another core.

    Most online tutorials and resources focus creating pools of workers and queues to send those workers something to be processed until a job is finished. I am however trying to send a new string repeatedly to FFMPEG through each iteration.

    How can I pipe my string to that process/instance of FFMPEG ?

    Or is what I’m trying to do not possible ?

    This was the working solution (with dumbed down FFMPEG settings) :

    #!/usr/bin/python
    import sys, os, multiprocessing
    import subprocess as sp
    import pygame
    from pygame.locals import QUIT, KEYUP, K_ESCAPE
    import pygame.display

    pygame.init()
    os.environ['SDL_VIDEODRIVER'] = 'dummy'
    pygame.display.init()
    Display_Surface = pygame.display.set_mode([1280,720], 0, 32)

    class FFMPEGConsumer(object):
       def __init__(self):
           self._r, self._w = multiprocessing.Pipe()
           self.reader = os.fdopen(self._r.fileno(), 'r')
           self.writer = os.fdopen(self._w.fileno(), 'w', 0)
           self.proc = None

       def start_ffmpeg(self):

           command = ['ffmpeg', '-framerate', '25', '-s', '1280x720', '-pix_fmt', 'rgba', '-f', 'rawvideo', '-i', '-',
              '-f', 'lavfi', '-i', 'anullsrc=cl=mono',
              '-pix_fmt', 'yuv420p','-s', 'hd720', '-r', '25', '-g', '50',
              '-f', 'flv', 'rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx']

           self.proc = sp.Popen(command, bufsize=-1, stdin=self.reader)

       def send_down_the_pipe(self, frame):
           self.writer.write(frame)
           #print self._stdin.read()

       def __del__(self):
           self.reader.close()
           self.writer.close()

    ffmpeg = FFMPEGConsumer()

    while True:
       # Quit event handling
       for event in pygame.event.get():
           if event.type == QUIT or (event.type == KEYUP and event.key == K_ESCAPE):
               pygame.quit()
               sys.exit()

       ffmpeg.send_down_the_pipe(pygame.image.tostring(Display_Surface, "RGBA"))
       proc.join()

    pipe.stdin.close()
    pygame.display.quit()
    os._exit()

    All cores are firing and no lags so far !!!

  • Emscripten compiling multiple main functions

    20 février 2018, par AlexVestin

    I’ve been trying to compile FFmpeg using Emscripten to export to WebAssembly code. I’ve been using the ffmpeg.js Makefile here, with very slight modifications. The compilation works fine without any errors, and generates a ffmpeg.bc, however if I try to compile the file along with another C file containing a main function I get the error

    error: Linking globals named ´main´: symbol multiply defined!
    ERROR:root:Failed to run llvm optimizations:

    The command I’m using is :

    ffmpeg-wasm.js: (FFMPEG_MP4_BC)
       emcc test.c $(FFMPEG_MP4_BC) $(MP4_SHARED_DEPS) $(EMCC_COMMON_ARGS)

    where

    EMCC_COMMON_ARGS = \
       -s TOTAL_MEMORY=67108864 \
       -s OUTLINING_LIMIT=20000 \
       -O3 --memory-init-file 0 \
       -o $@ \
       -s WASM=1 \
       -I/usr/local/include

    I have tried using a different snapshot of ffmpeg, which didn’t fix the problem.

    If I run

    llvm-nm $(find . -name *.so) > log.txt && grep -n ./log.txt -e "int main"

    to test if any of the dependencies contain a main, I get nothing, however there is a global main function in the generated ffmpeg.bc.

    So, is there any way to remove the main function from the library, or some flag to set to prevent a global main function from being generated ?

  • avcodec/vc1 : add Simple and Main profile to vc1_put_signed_blocks_clamped

    6 juin 2018, par Jerome Borsboom
    avcodec/vc1 : add Simple and Main profile to vc1_put_signed_blocks_clamped
    

    Simple and Main profile also need unsigned put_pixels_clamped. Add an argument
    to choose between signed and unsigned put_pixels and change function name to
    vc1_put_blocks_clamped.

    Signed-off-by : Jerome Borsboom <jerome.borsboom@carpalis.nl>

    • [DH] libavcodec/vc1_block.c