Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (82)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (6937)

  • 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