Recherche avancée

Médias (91)

Autres articles (93)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

Sur d’autres sites (4555)

  • How Read .mp4 video and then put it in NamedPipeServerStream ?

    23 mars 2019, par Oleg Pi

    How I Might Put .mp4 readed with StreamReader and then put it into pipe ?
    I need to read the data and send it to the pipe. I read the .mpg4 file. Then I process it through ffmpeg. Am I trying to send the file to the pipe correctly ?

    public void getVideoFramesFromLocalPath(string fileName, string outputFileName, int period)
       {
           Thread th1 = new Thread(new ParameterizedThreadStart(PipeLine));
           th1.Start(fileName);            

           int bitrate = 5000;
           int fps = 10;

           string strTakeFrame = $"-f image2pipe -i pipe:videoPipe -qscale:v 4 -vf fps=1/{period} {outputFileName}_%04d.jpg";      

           ffProcessStart(strTakeFrame);
       }

       private async void PipeLine(object fileName)
       {
           StreamReader SR = new StreamReader((string)fileName);
           NamedPipeServerStream pipeServer = new NamedPipeServerStream("videoPipe", PipeDirection.Out);
           pipeServer.WaitForConnection();
           StreamWriter SW = new StreamWriter(pipeServer);
           SW.Write(SR.ReadToEnd());
           SW.Flush();
       }
       static void ffProcessStart(string commandLine)
       {
           ProcessStartInfo startInfo = new ProcessStartInfo();            

           startInfo.CreateNoWindow = false;                                

           startInfo.UseShellExecute = false;                              

           startInfo.FileName = @"ffmpeg.exe";                            

           startInfo.WindowStyle = ProcessWindowStyle.Hidden;              

           startInfo.Arguments = commandLine;                              

           try
           {
               using (Process exeProcess = Process.Start(startInfo))      
               {
                   exeProcess.WaitForExit();                              
               }
           }
           catch (Exception e)
           {
               Console.WriteLine(e);
           }
       }
  • ffmpeg posting to nginx hangs after 90 minutes

    22 octobre 2018, par Harnek Gulati

    I’m using a very simple program to push an ffmpeg stream from my raspberry pi camera to a nginx server. However, it fails after 90 minutes, with almost every single Raspberry Pi I use (I have this code on 12 Raspberry Pis).
    Here is my ffmpeg command :

    raspivid -o - -t 0 -w 640 -h 480 -fps 25 | ffmpeg -re -i - -vcodec copy -hls_time 4 -f hls -hls_list_size 5 -hls_wrap 5 -threads 0  -timeout 5000 -max_reload 20000 -method PUT http://{}:{}/live/{}

    And here is my configuration for nginx.conf :

    #user nobody;
    load_module /usr/lib/nginx/modules/ndk_http_module.so;
    load_module /usr/lib/nginx/modules/ngx_http_lua_module.so;

    worker_processes auto;
    env CONTROL_SERVER_IP;


    #error_log /var/log/nginx/error.log;
    error_log /dev/stdout info;
    events {
       worker_connections 1024;
    }

    http {
       include     mime.types;
       default_type    application/octet-stream;
       access_log /dev/stdout;
       sendfile on;
       keepalive_requests 100000;
       keepalive_timeout 30;

     client_max_body_size 10M;
     server {
       listen 80;
       server_name localhost;

       location /live {
         root /var/static;
               client_body_temp_path   /var/static/client_temp;

               dav_methods PUT;
               create_full_put_path on;
               dav_access user:rw  group:r     all:r;

               types {
                   application/vnd.apple.mpegurl m3u8;
               }

               # Disable Cache
               add_header Cache-Control no-cache;
               include cors.conf;
     }
     }
    }

    daemon off;

    If anyone can help me, I would deeply appreciate it. I’ve been pulling my hair out trying to figure out this bug. On the raspberry pi, it hangs on this :

    [hls @ 0x25a8c90] Opening 'http://192.168.8.1:80/live/c35d8935-0a31-4d22-b71a-ad3f4f1d47631.ts' for writing
    frame=105609 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105518 speed=1.02xframe=105623 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105532 speed=1.02xframe=105636 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105545 speed=1.02xframe=105648 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105557 speed=1.02xframe=105662 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105571 speed=1.02xframe=105674 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105583 speed=1.02xframe=105688 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105597 speed=1.02xframe=105700 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105609 speed=1.02xframe=105714 fps= 25 q=-1.0 q=1.6 size=N/A time=01:11:40.00 bitrate=N/A dup=0 drop=105623 speed=1.02x[hls muxer @ 0x25a9200] Duplicated segment filename detected: c35d8935-0a31-4d22-b71a-ad3f4f1d47631.ts
    [hls @ 0x25a8c90] Opening 'http://192.168.8.1:80/live/c35d8935-0a31-4d22-b71a-ad3f4f1d47632.ts' for writing

    And on the nginx logs, I get :

    192.168.10.242 - - [21/Oct/2018:22:34:01 +0000] "PUT /live/c35d8935-0a31-4d22-b71a-ad3f4f1d4763.m3u8 HTTP/1.1" 204 0 "-" "Lavf/57.83.100"
    192.168.10.242 - - [21/Oct/2018:22:35:04 +0000] "PUT /live/c35d8935-0a31-4d22-b71a-ad3f4f1d47633.ts HTTP/1.1" 408 0 "-" "Lavf/57.83.100"

    I need to set up a way to either a) keep consistent connections longer than 90 minutes or b) detect when the 408 error happens and stop it from hanging.

    FFMPEG version : 3.4.1

  • Gstreamer Multiple Source with Single Sink Implementation in PythonGST

    11 octobre 2018, par biswajitGhosh

    I’m new to Gstreamer as well as Python-GST also. I have to collect multiple source raw video stream data into a single sink, I don’t know, if it is possible or not.

    Lets explain more my scenario :

    I have 2 video source server for now, one is my webcam and another is just an mp4 file, I did open those source using following command

    Source1 :

    gst-launch-1.0 v4l2src device=/dev/video0 !
    ’video/x-raw,width=640,height=480’ ! x264enc pass=qual quantizer=20
    tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=5000

    Source2 :

    gst-launch-1.0 filesrc location = file_name.mp4 !
    ’video/x-raw,width=640,height=480’ ! x264enc pass=qual quantizer=20
    tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=5000

    I’m trying to send both stream data to localhost 5000 port after encoding with H264.

    For receiving I have a Python Sink Server like this :

    import gi
    gi.require_version('Gst', '1.0')
    gi.require_version('GstApp', '1.0')
    from gi.repository import GObject, Gst, GstApp

    GObject.threads_init()
    Gst.init(None)
    GST_DEBUG="6"

    class Example:
       def __init__(self):
           self.mainloop   = GObject.MainLoop()
           self.pipeline   = Gst.Pipeline.new("Pipeline")
           self.bus        = self.pipeline.get_bus()
           self.bus.add_signal_watch()
           self.bus.connect("message", self.on_message)
           # self.bus.connect('message::eos', self.on_eos)
           # self.bus.connect('message::error', self.on_error)
           # self.bus.connect("sync-message::element", self.on_sync_message)

           #Create QUEUE elements
           self.queue1     = Gst.ElementFactory.make("queue",          None)
           self.queue2     = Gst.ElementFactory.make("queue",          None)

           # Create the elements
           self.source     = Gst.ElementFactory.make("udpsrc",         None)
           self.depay      = Gst.ElementFactory.make("rtph264depay",   None)
           self.parser     = Gst.ElementFactory.make("h264parse",      None)
           self.decoder    = Gst.ElementFactory.make("avdec_h264",     None)
           self.sink       = Gst.ElementFactory.make("appsink",        None)

           # Add elements to pipeline
           self.pipeline.add(self.source)
           self.pipeline.add(self.queue1)
           self.pipeline.add(self.depay)
           self.pipeline.add(self.parser)
           self.pipeline.add(self.decoder)
           self.pipeline.add(self.queue2)
           self.pipeline.add(self.sink)

           # Set properties
           self.source.set_property('port', 5000)
           self.source.set_property('caps', Gst.caps_from_string("application/x-rtp, encoding-name=H264,payload=96"))
           self.sink.set_property('emit-signals', True)
           # turns off sync to make decoding as fast as possible
           self.sink.set_property('sync', False)
           self.sink.connect('new-sample', self.on_new_buffer, self.sink)




       def on_new_buffer(self, appsink, data):
           print "exec two..."
           appsink_sample = GstApp.AppSink.pull_sample(self.sink)
           # with open('example.h264', 'a+') as streamer:
           buff = appsink_sample.get_buffer()
           size, offset, maxsize = buff.get_sizes()
           frame_data = buff.extract_dup(offset, size)
           print(size)
           # flag, info = buff.map(Gst.MapFlags.READ)
           # streamer.write(info.data)
           # print(info.size)
           return False

       def run(self):
           ret = self.pipeline.set_state(Gst.State.PLAYING)        
           if ret == Gst.StateChangeReturn.FAILURE:
               print("Unable to set the pipeline to the playing state.")
               exit(-1)

           self.mainloop.run()

       def kill(self):
           self.pipeline.set_state(Gst.State.NULL)
           self.mainloop.quit()

       def on_eos(self, bus, msg):
           print('on_eos()')
           self.kill()

       def on_error(self, bus, msg):
           print('on_error():', msg.parse_error())
           self.kill()

       def on_message(self, bus, message):
           t = message.type
           if t == Gst.MessageType.EOS:
               print "End of Stream :("
               self.kill()
           elif t == Gst.MessageType.ERROR:
               err, debug = message.parse_error()
               print "Error: %s" % err, debug
               self.kill()


       def on_sync_message(self, bus, message):
           print message.src


    example = Example()
    example.run()

    Firstly AppSink callback does not working, I don’t know why ? I think I have to make that configuration correct into Python Code. Can any one please help to figure it out ?

    Secondly when I tried with FFMpeg and FFPlay I got so many H264 encoding issues like this :

    enter image description here

    Main confusion is Can GStreamer handle Multiple Source data into a single sink(I need to distinguished each video frame).

    Thanks a lot.