Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (73)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (11549)

  • Custom real-time input for ffmpeg in C

    10 août 2016, par Victor.dMdB

    I’m implementing a custom io with avformat_alloc_context and avio_alloc_context to be able to read the output of another function in real-time. A buffer is populated by this function in a boost asio thread, while ffmpeg is reading this buffer from another thread.

    I initialise an io buffer where this function writes into, and which ffmpeg reads :

    BufferData input_buffer = {0};
    input_buffer.size = 65536;
    input_buffer.ptr = (uint8_t *) av_malloc(buf_size);
    memset(input_buffer.ptr,'0',100);

    fprintf(stdout, "initialisation: buffer pointer %p buffer data pointer: %p\n", &input_buffer, input_buffer.ptr);

    Why i do the memset is explained here.
    Then to test out the pointer address I did :

    BufferData * decode_buffer;
    decode_buffer->size = 65536;
    decode_buffer->ptr = (uint8_t *) av_malloc(decode_buffer->size);

    AVIOContext * av_io_ctx = avio_alloc_context(decode_buffer->ptr, decode_buffer->size, 0, &input_buffer, &read_function, NULL, NULL);

    AVFormatContext *av_fmt_ctx = avformat_alloc_context();
    av_fmt_ctx->pb = av_io_ctx;


    BufferData * tmpPtr = (BufferData * ) video_input_file->av_io_ctx->opaque;

    fprintf(stdout, "video decoder before: buffer pointer %p, buffer data pointer: %p\n", tmpPtr, tmpPtr->ptr);

    open_res = avformat_open_input(&av_fmt_ctx, "anyname", in_fmt, options ? &options : NULL);

    fprintf(stdout, "video decoder after: buffer pointer %p, buffer data pointer: %p\n", tmpPtr, tmpPtr->ptr);

    For reference

    typedef struct {
       uint8_t *ptr;
       size_t size;
    } BufferData;

    The read function

    static int read_function(void* opaque, uint8_t* buf, int buf_size) {
       BufferData *bd = (BufferData *) opaque;
       buf_size = FFMIN(buf_size, bd->size);
       memcpy(buf, bd->ptr, buf_size);
       bd->ptr  += buf_size; //This seemed to cause the problem
       bd->size -= buf_size;
       return buf_size;
    }

    And the result will be :

    initialisation: buffer pointer 0x7f2c4a613620, buffer data pointer: 0x7f2c48c56040

    video decoder before: buffer pointer 0x7f2c4a613620, buffer data pointer: 0x7f2c48c56040

    video decoder after: buffer pointer 0x7f2c4a613620, buffer data pointer: 0x7f2c49e24b50

    Is it a normal behaviour that the buffer data ptr is changed by avformat_open_input ? since I would like to keep the initial pointer address given I am using it in another function, and have malloced it the required memory.

  • Video streaming FFMPEG - VLC video starts black

    7 novembre 2020, par xKedar

    I am trying to stream my webcam when an event occurs to another machine.
Giving the fact that FFMPEG needs around 2 seconds since I call it to when it starts streaming I'm running it in background sending everything to a local socket that consumes it until the event happens and then I reverse the data to the other machine

    


    Here I capture the camera

    


    class ffmpegThread (Thread):
    def __init__(self):
        Thread.__init__(self)
     
    def run(self):
        cam, mic = detect_devices()
        command = 'ffmpeg -f dshow -i video='+cam+':audio='+mic+' -profile:v high -pix_fmt yuvj420p -level:v 4.1 -preset ultrafast -tune zerolatency -vcodec libx264 -r 14 -b:v 512k -s 240x160 -acodec aac -ac 2 -ab 32k -ar 44100 -f mpegts -flush_packets 0 udp://127.0.0.1:'+str(config.ffmpeg_port)+'?pkt_size=1316'
        p = Popen(command , stderr=PIPE)
        for line in iter(p.stderr.readline,''):
           if config.end: break
        p.terminate()
        return 0


    


    This is where I receive and forward the video

    


    
class sendVideoThread (Thread):
    def __init__(self, UDPsenderSocket):
        Thread.__init__(self)
        self.UDPsenderSocket = UDPsenderSocket
 
    def run(self):
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.bind(("127.0.0.1", config.ffmpeg_port))
        bufferSize  = 1348
        firstData = sock.recvfrom(bufferSize)
        while True:
            data = sock.recvfrom(bufferSize)
            if config.event == True:
                startTime = time.time()
                self.UDPsenderSocket.sendto(firstData[0], config.address)
                while time.time() - startTime < 14:
                    self.UDPsenderSocket.sendto(data[0], config.address) 
                    data = sock.recvfrom(bufferSize)                    
                config.event= False
            if config.end: sys.exit()



    


    And those are the vlc options on the other machine(not the whole code)

    


        def play(self):
        self.player = vlc.Instance(["--file-caching=0 --network-caching=0"]).media_player_new()
        self.player.set_mrl('udp://@0.0.0.0:'+str(config.vlcPlayer_port))
        self.player.set_hwnd(self.frame.winfo_id())
        self.player.audio_set_mute(False)
        self.player.play()



    


    The video reaches the other machine but it starts black with audio-only for some seconds then it starts working fine. I guess that by sending the video from a random moment(frame) when the event happens it may happen that vlc will miss some information about the video and needs the next frame with information to come in order to show the video, I was looking to something in order to have more frames with that info but I was not able to find it.

    


  • Merge commit ’86e1a35802df42f51337d3fed8d5d99d0898c8bf’

    20 avril 2015, par Michael Niedermayer
    Merge commit ’86e1a35802df42f51337d3fed8d5d99d0898c8bf’
    

    * commit ’86e1a35802df42f51337d3fed8d5d99d0898c8bf’ :
    h264_ps : Return meaningful error codes and address a memory leak

    Conflicts :
    libavcodec/h264_ps.c

    Merged-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/h264_ps.c