Recherche avancée

Médias (91)

Autres articles (84)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (7426)

  • How to send an mpeg_ts stream verbatim over rtp

    30 mars 2018, par Bruce Adams

    I’m trying to write some software to capture and process data from an mpeg_ts stream.
    As part of this I need, for testing, to generate a test mpeg_ts streams for my software to capture

    One option for this is to save a real stream to disk.
    So with that in mind I have a source transport stream which is being unicast via rtp to my box via port 1234. I can view it in vlc using :

    vlc rtp://@:1234

    and I can move between channels via the "programme" menu.
    subtitles are available but no EPG
    kaffeine works as well but only shows the first channel

    I can save this stream using :

    ffmpeg -i rtp://172.16.13.81:1235 -map 0 -copy_unknown -c copy save_ffmpeg.ts

    note : that rtp ://@:1235 does not work you need your full IP address though udp ://@:1235 does work for udp streams - see https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2386

    However there is a problem. When I try to open the resulting file save_ffmpeg.ts in VLC
    instead of opening one channel at a time it opens a new window for each channel which indicates an issue.

    If on the other hand I save it using :

    cvlc rtp://@:1235 :demux=dump :demuxdump-file=save_vlc.ts

    the resulting ts file can be viewed as normal.
    What is the difference ?

    Looking at the output of mediainfo on save_ffmpeg.ts vs save_vlc.ts
    I can see that ffmpeg has stripped the streams labelled Menu #1 to Menu #5.

    >mediainfo save_ffmpeg.ts  | grep -E '^[A-Za-z]+ #'
    Video #1
    Video #2
    Video #3
    Video #4
    Video #5
    Audio #1
    Audio #2
    Audio #3
    Audio #4
    Audio #5
    Audio #6
    Audio #7
    >mediainfo save_vlc.ts  | grep -E '^[A-Za-z]+ #'
    Video #1
    Video #2
    Video #3
    Video #4
    Video #5
    Audio #1
    Audio #2
    Audio #3
    Audio #4
    Audio #5
    Audio #6
    Audio #7
    Menu #1
    Menu #2
    Menu #3
    Menu #4
    Menu #5

    I tried adding -map_metadata 0 but to no avail.

    Q1 What is wrong with the ffmpeg command ?
    How do I get it to also save the menu streams ?

    Now I can send the ts that has the menu with ffmpeg using :

    ffmpeg -re -i save_vlc.ts -c copy -f mpegts udp://127.0.0.1:9999

    to get one channel
    but again if I try to send everything :

    ffmpeg -re -i ./save_file.ts -map 0 -map_metadata 0 -copy_unknown -c copy -f rtp_mpegts rtp://127.0.0.1:9999

    then :

    vlc rtp://127.0.0.1:9999

    opens a window for each and every channel.

    Q2 How do I fix this ?

    Q3 What would the equivalent gstreamer commands be to send and recieve ts files ?

    The relevance of the final question is that one of the options being considered for implementing the MPEG_TS reader is gstreamer. Though, it probably warrants a question of its own.

  • 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 !!!

  • How to simplify the script for ffmpeg ?

    27 mars 2018, par Pravesh Kumar

    I want this script to be simplified

    I am having this given simple script ; I would like to simplify this script can anyone help me to add text with the proper time interval and fade in and out effect.

    ffmpeg -y -i video.mp4 -filter_complex \
    "[0]split[base][text];[text] \
    drawtext=fontfile=gvr.otf:text='Which of these is not an event listener adapter defined in the java.awt.event package?': fontcolor=white: fontsize=40: x=100:y=200, \
    format=yuva444p,fade=t=in:st=1:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[subtitles]; \
    [base][subtitles]overlay" test_out.mp4

    ffmpeg -y -i test_out.mp4 -filter_complex \
    "[0]split[base][text];[text] \
    drawtext=fontfile=gvr.otf:text='a) public void apple(String s, int i) {}': fontcolor=white: fontsize=40: x=100:y=(200) + 50 * 2, \
    format=yuva444p,fade=t=in:st=3:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[subtitles]; \
    [base][subtitles]overlay" test_out1.mp4

    ffmpeg -y -i test_out1.mp4 -filter_complex \
    "[0]split[base][text];[text] \
    drawtext=fontfile=gvr.otf:text='b) public int apple(int i, String s) {}': fontcolor=white: fontsize=40: x=100:y=(200) + 50 * 3, \
    format=yuva444p,fade=t=in:st=4:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[subtitles]; \
    [base][subtitles]overlay" test_out2.mp4

    ffmpeg -y -i test_out2.mp4 -filter_complex \
    "[0]split[base][text];[text] \
    drawtext=fontfile=gvr.otf:text='c) public void apple(int i, String mystring) {}': fontcolor=white: fontsize=40: x=100:y=(200) + 50 * 4, \
    format=yuva444p,fade=t=in:st=5:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[subtitles]; \
    [base][subtitles]overlay" test_out3.mp4

    ffmpeg -y -i test_out3.mp4 -filter_complex \
    "[0]split[base][text];[text] \
    drawtext=fontfile=gvr.otf:text='d) public void Apple(int i, String s) {}': fontcolor=white: fontsize=40: x=100:y=(200) + 50 * 5, \
    format=yuva444p,fade=t=in:st=6:d=1:alpha=1,fade=t=out:st=8:d=1:alpha=1[subtitles]; \
    [base][subtitles]overlay" test_out4.mp4