Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (99)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Que fait exactement ce script ?

    18 janvier 2011, par

    Ce script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
    Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
    Installation de dépendances de MediaSPIP
    Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
    Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...)

Sur d’autres sites (10443)

  • Pipe video frame to OpenCV image and then to FFmpeg

    8 février 2018, par Pureheart

    There is a similar question here :
    Getting ’av_interleaved_write_frame() : Broken pipe’ error

    But what should I do if I want to write the data ?

    I put pipe_out.stdin.write(image.tostring()) in the while loop, like this

    FFMPEG_BIN = "/home/media/Downloads/ffmpeg"
    import subprocess as sp
    import sys
    width = 360
    height = 240
    command_in = [ FFMPEG_BIN,
               '-i', '/home/media/Videos/mytestvideo/zhou.avi',
               '-f', 'image2pipe',
               '-pix_fmt', 'bgr24',
               '-vcodec', 'rawvideo', '-']
    pipe_in = sp.Popen(command_in, stdout = sp.PIPE, bufsize = 10**8)

    command_out = [ FFMPEG_BIN,
           '-y', # (optional) overwrite output file if it exists
           '-f', 'rawvideo',
           '-vcodec','rawvideo',
           '-s', '360x240', # size of one frame
           '-pix_fmt', 'bgr24',
           '-r', '28', # frames per second
           '-i', '-', # The imput comes from a pipe
           '-an', # Tells FFMPEG not to expect any audio
           #'-vcodec', 'mpeg',
           'my_output_videofile.mp4' ]

    pipe_out = sp.Popen( command_out, stdin=sp.PIPE, stderr=sp.PIPE)

    import numpy
    import cv2
    import pylab
    # read width*height*3 bytes (= 1 frame)
    while True:
       raw_image = pipe_in.stdout.read(width*height*3)
       image =  numpy.fromstring(raw_image, dtype='uint8')
       image = image.reshape((height,width,3))
       pipe_in.communicate()
       pipe_out.stdin.write(image.tostring())
       pipe_out.communicate()
       pipe_in.stdout.flush()
       #cv2.imshow('image',image)
       #cv2.waitKey(0)
       # throw away the data in the pipe's buffer.


    '''
    pipe_in.stdin.close()
    pipe_in.stderr.close()
    pipe_in.wait()
    pipe_out.stdout.close()
    pipe_out.stderr.close()
    pipe_out.wait()
    '''
    #pipe_out.stdin.write(image.tostring())

    However, the output video has only 1 frame(the first frame of input video)

    Any ideas ?

    Thanks !

  • youtube-dl streaming to pipe, how to add container

    24 décembre 2017, par MetNP

    I use this command on raspberry-pi :

    youtube-dl -o- [youtubeurl] | omxplayer --no-keys pipe:0

    and it works great for 50% of youtube content. For non-working videos, omxplayer just won’t play it. It is not raspberry nor omxplayer specific problem. All players are ffmpeg based and for those videos the same problem can be achieved on any platform with ffplay or ffmpeg live transcode...

    When i download that kind of video separatelly :

    youtube-dl -o name.mp4 [url]
    ffplay name.mp4                   ... works OK
    cat name.mp4 | ffplay -           ... does NOT work (input stream not recognized well)

    Reason for this problem is well explained here. MP4 by itself is not good enough for streaming, and i want just to envelope it inside some TS or MKV or any container that will help player.

    Does someone have an idea how to do it ? Can youtube-dl be forced to do it itself, and can some middle ffmpeg command helps ?

    update : thanks to directions from Mulvya comment, it seems that all video works well with -f mp4 addition :

    youtube-dl -o- -f mp4 [youtubeurl] | omxplayer --no-keys pipe:0

    selecting specific format like -f 135+140 breaks pipe usability, and will not work except with some possible code changes. Until i reach some other problematic video content, it seems that -f mp4 solved everything.

  • spawn ffmpeg in nodejs and pipe to express's response

    18 décembre 2017, par ViGi

    i am spawning ffmpeg and pipe it’s output (the video stream i want) to express’s response object like this :

    app.get('/stream', (req, res) => {
       let _url = req.query.url;

       if(_url){  

           res.writeHead(200, {
               'Access-Control-Allow-Origin': '*',
               'Connection': 'Keep-Alive',
               'Content-Type': 'video/mp4'
           });

           // transcode rtsp input from ip-cam to mp4 file format (video: h.264 | audio: aac)
           let ffmpeg = child_process.spawn("ffmpeg",[
               "-probesize","2147483647",
               "-analyzeduration","2147483647",
               "-i", _url,
               "-vcodec","copy",
               "-f", "mp4",            
               "-movflags","frag_keyframe+empty_moov+faststart",
               "-frag_duration","3600",
               "pipe:1"              
           ]);        


           // redirect transcoded ip-cam stream to http response
           ffmpeg.stdout.pipe(res);

           // error logging
           ffmpeg.stderr.setEncoding('utf8');      
           ffmpeg.stderr.on('data', (data) => {
               console.log(data);
           });
       }
       else{
           res.end();
       }

    so far it’s working like a charm.
    however somewhere in there seems to be a cap. i can get only 3 streams running at the same time. when a 4th spawn occurs the 4th thread will block one of the cpu cores :

    htop of my raspberry pi 3

    and naturally the 4th stream does not reach the browser..
    has somebody any idea of what am i missing ?

    EDIT : it’s not tied to the fact that i am running the nodejs project on the raspberry pi. it also behaves the same way on my windows 10 machine