Recherche avancée

Médias (0)

Mot : - Tags -/upload

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (111)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (13876)

  • FFmpeg remux rtp to mpegts [closed]

    16 décembre 2013, par Ardoramor

    I am trying to remux rtp stream into mptegts format. I have an SDP file with the following contents :

    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.17.44
    t=0 0
    a=recvonly
    a=orient:portrait
    m=video 8202 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;profile-level-id=428028;sprop-parameter-sets=Z0KAKJWgKA9E,aM48gA==;
    a=control:trackID=1

    I execute the following ffmpeg command :

    ffmpeg -i "test.sdp" -f mpegts -vcodec copy "/tmp/test.ts"

    And I get the following information :

    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.066622, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x1101d4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0

    I receive the following error :

    [mpegts @ 0x1c85f960] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    So I add the suggested bitstream filter :

    ffmpeg -i "test.sdp" -f mpegts -vbsf h264_mp4toannexb "/tmp/test.ts"

    But the h264 encoding now becomes h262 (mpeg2video) :

    ~$ffprobe /tmp/test.ts
    Input #0, mpegts, from '/tmp/test.ts':
     Duration: 00:00:04.13, start: 1.400000, bitrate: 640 kb/s
     Program 1
       Metadata:
         service_name    : Unnamed
         service_provider: FFmpeg
       Stream #0.0[0x100]: Video: mpeg2video (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc

    Is there any way to keep the h264 codec without re-encoding it ? Doing so becomes very CPU intensive.

    Update

    Hopefully this will clear up the issue and remove the off-topic stamp.

    I'm writing an Android app that is based off of SpyDroids streaming architecture. The app communicates with the server, providing it the SDP. The server spawns an ffmpeg process to remux the incoming video stream into mpegts and broadcasts it on multicast (right now just file).

    SpyDroid performs streaming by sending recorded mp4 file through localsocket, received h264 packets, supposedly (according to code removed mp4 h264 prefix [annexb]), wraps it with rtp headrs and sends it on its way. Thus, the RPT stream I get is clearly not originally generated as such.

    As @Wagner Patriota has mentioned, I should add '-vcodec copy'. I had run the remuxing with it before as well but the error is still present (full output) :

    ~$ffmpeg -i "test.sdp" -f mpegts -vcodec copy -vbsf h264_mp4toannexb "/tmp/test.ts"
    ffmpeg version 0.8.6, Copyright (c) 2000-2011 the FFmpeg developers
     built on Jan 30 2012 17:17:54 with gcc 4.5.2
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --disable-avisynth --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libx264 --enable-libxvid --extra-cflags='-O2 -g -m64 -mtune=generic -fPIC' --disable-stripping --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2
     libavutil    51.  9. 1 / 51.  9. 1
     libavcodec   53.  7. 0 / 53.  7. 0
     libavformat  53.  4. 0 / 53.  4. 0
     libavdevice  53.  1. 1 / 53.  1. 1
     libavfilter   2. 23. 0 /  2. 23. 0
     libswscale    2.  0. 0 /  2.  0. 0
     libpostproc  51.  2. 0 / 51.  2. 0
    [h264 @ 0x16b4b1c0] concealing 232 DC, 232 AC, 232 MV errors
    [h264 @ 0x16b4b1c0] concealing 63 DC, 63 AC, 63 MV errors
    [h264 @ 0x16b4b1c0] concealing 25 DC, 25 AC, 25 MV errors
    [h264 @ 0x16b4b1c0] concealing 138 DC, 138 AC, 138 MV errors
    [h264 @ 0x16b4b1c0] concealing 69 DC, 69 AC, 69 MV errors
    [sdp @ 0x16b43400] Estimating duration from bitrate, this may be inaccurate

    Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.033256, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x16b4a4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0
    Press [q] to stop, [?] for help
    h264_mp4toannexb failed for stream 0, codec copy: Invalid argument
    [mpegts @ 0x16b4a4c0] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    The error reports that the invalid argument has been supplied. Increased loglevel does not give any more information. I know that ffmpeg is sometimes finicky with argument order. However, they seen to be in order of documentation as well as suggested order by @Wagner Patriota.

  • FFmpeg remux rtp to mpegts [on hold]

    16 décembre 2013, par Ardoramor

    I am trying to remux rtp stream into mptegts format. I have an SDP file with the following contents :

    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.17.44
    t=0 0
    a=recvonly
    a=orient:portrait
    m=video 8202 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;profile-level-id=428028;sprop-parameter-sets=Z0KAKJWgKA9E,aM48gA==;
    a=control:trackID=1

    I execute the following ffmpeg command :

    ffmpeg -i "test.sdp" -f mpegts -vcodec copy "/tmp/test.ts"

    And I get the following information :

    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.066622, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x1101d4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0

    I receive the following error :

    [mpegts @ 0x1c85f960] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    So I add the suggested bitstream filter :

    ffmpeg -i "test.sdp" -f mpegts -vbsf h264_mp4toannexb "/tmp/test.ts"

    But the h264 encoding now becomes h262 (mpeg2video) :

    ~$ffprobe /tmp/test.ts
    Input #0, mpegts, from '/tmp/test.ts':
     Duration: 00:00:04.13, start: 1.400000, bitrate: 640 kb/s
     Program 1
       Metadata:
         service_name    : Unnamed
         service_provider: FFmpeg
       Stream #0.0[0x100]: Video: mpeg2video (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc

    Is there any way to keep the h264 codec without re-encoding it ? Doing so becomes very CPU intensive.

    Update

    Hopefully this will clear up the issue and remove the off-topic stamp.

    I'm writing an Android app that is based off of SpyDroids streaming architecture. The app communicates with the server, providing it the SDP. The server spawns an ffmpeg process to remux the incoming video stream into mpegts and broadcasts it on multicast (right now just file).

    SpyDroid performs streaming by sending recorded mp4 file through localsocket, received h264 packets, supposedly (according to code removed mp4 h264 prefix [annexb]), wraps it with rtp headrs and sends it on its way. Thus, the RPT stream I get is clearly not originally generated as such.

    As @Wagner Patriota has mentioned, I should add '-vcodec copy'. I had run the remuxing with it before as well but the error is still present (full output) :

    ~$ffmpeg -i "test.sdp" -f mpegts -vcodec copy -vbsf h264_mp4toannexb "/tmp/test.ts"
    ffmpeg version 0.8.6, Copyright (c) 2000-2011 the FFmpeg developers
     built on Jan 30 2012 17:17:54 with gcc 4.5.2
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --disable-avisynth --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libx264 --enable-libxvid --extra-cflags='-O2 -g -m64 -mtune=generic -fPIC' --disable-stripping --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2
     libavutil    51.  9. 1 / 51.  9. 1
     libavcodec   53.  7. 0 / 53.  7. 0
     libavformat  53.  4. 0 / 53.  4. 0
     libavdevice  53.  1. 1 / 53.  1. 1
     libavfilter   2. 23. 0 /  2. 23. 0
     libswscale    2.  0. 0 /  2.  0. 0
     libpostproc  51.  2. 0 / 51.  2. 0
    [h264 @ 0x16b4b1c0] concealing 232 DC, 232 AC, 232 MV errors
    [h264 @ 0x16b4b1c0] concealing 63 DC, 63 AC, 63 MV errors
    [h264 @ 0x16b4b1c0] concealing 25 DC, 25 AC, 25 MV errors
    [h264 @ 0x16b4b1c0] concealing 138 DC, 138 AC, 138 MV errors
    [h264 @ 0x16b4b1c0] concealing 69 DC, 69 AC, 69 MV errors
    [sdp @ 0x16b43400] Estimating duration from bitrate, this may be inaccurate

    Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.033256, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x16b4a4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0
    Press [q] to stop, [?] for help
    h264_mp4toannexb failed for stream 0, codec copy: Invalid argument
    [mpegts @ 0x16b4a4c0] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    The error reports that the invalid argument has been supplied. Increased loglevel does not give any more information. I know that ffmpeg is sometimes finicky with argument order. However, they seen to be in order of documentation as well as suggested order by @Wagner Patriota.

  • Bitmap images to WEBM video encoding

    21 novembre 2013, par Ankush

    I am trying to encode bitmap images to webm video,but generated video is not playable
    Here is code I am using,code works fine for H624.
    While encoding console windows shows : [libvpx @ 009b2f60] v1.2.0
    there is no webm string in produced video file. Any clue ? ( I am newbie for FFMPEG API )

    void create_from_bmp()
    {
    CFile file[5];  
    BYTE *szTxt[5];  

    int nWidth = 0;  
    int nHeight= 0;  

    int nDataLen=0;  

    int nLen;  

    CString csFileName;  
    for (int fileI = 1; fileI <= 5; fileI ++)  
    {
     csFileName.Format("e:\\pics\\%d.bmp",fileI);  
     file[fileI - 1].Open(csFileName,CFile::modeRead | CFile::typeBinary);  
     nLen = file[fileI - 1].GetLength();  

     szTxt[fileI -1] = new BYTE[nLen];  
     file[fileI - 1].Read(szTxt[fileI - 1], nLen);  
     file[fileI - 1].Close();  

     //BMP bmi;//BITMAPINFO bmi;  
     //int nHeadLen = sizeof(BMP);  
     BITMAPFILEHEADER bmpFHeader;  
     BITMAPINFOHEADER bmpIHeader;  
     memcpy(&bmpFHeader,szTxt[fileI -1],sizeof(BITMAPFILEHEADER));  

     int nHeadLen = bmpFHeader.bfOffBits - sizeof(BITMAPFILEHEADER);  
     memcpy(&bmpIHeader,szTxt[fileI - 1]+sizeof(BITMAPFILEHEADER),nHeadLen);  

     nWidth = bmpIHeader.biWidth;// 464;// bmi.bmpInfo.bmiHeader.biWidth;// ;  
     nHeight = bmpIHeader.biHeight;//362;// bmi.bmpInfo.bmiHeader.biHeight;// ;  

     szTxt[fileI - 1] += bmpFHeader.bfOffBits;  
     nDataLen = nLen-bmpFHeader.bfOffBits;  
    }  

    av_register_all();  
    avcodec_register_all();  
    AVFrame *m_pRGBFrame =  new AVFrame[1];  //RGB    
    AVFrame *m_pYUVFrame = new AVFrame[1];;  //YUV
    AVCodecContext *c= NULL;  
    AVCodecContext *in_c= NULL;  
    AVCodec *pCodecH264;
    uint8_t * yuv_buff;//  

    pCodecH264 = avcodec_find_encoder(CODEC_ID_VP8);  
    if(!pCodecH264)  
    {  
     fprintf(stderr, "h264 codec not found\n");  
     exit(1);  
    }  

    c= avcodec_alloc_context3(pCodecH264);  
    c->bit_rate = 3000000;// put sample parameters  
    c->width =nWidth;//  
    c->height = nHeight;//  

    // frames per second  
    AVRational rate;  
    rate.num = 1;  
    rate.den = 5;  //5 frames per sec
    c->time_base= rate;//(AVRational){1,25};  
    c->gop_size = 10; // emit one intra frame every ten frames   //emit one iframe per sec
    c->max_b_frames=0;  //
    c->thread_count = 1;  
    c->pix_fmt = PIX_FMT_YUV420P;//PIX_FMT_RGB24;  
    c->codec_id=CODEC_ID_VP8;

    //av_opt_set(c->priv_data, /*"preset"*/"libvpx-1080p.ffpreset", /*"slow"*/NULL, 0);  
    if(avcodec_open2(c,pCodecH264,NULL)<0)  
     printf("Cant open codec");

    int size = c->width * c->height;  

    yuv_buff = (uint8_t *) malloc((size * 3) / 2); // size for YUV 420    

    uint8_t * rgb_buff = new uint8_t[nDataLen];  

    int outbuf_size=400000;  
    uint8_t * outbuf= (uint8_t*)malloc(outbuf_size);  
    int u_size = 0;  
    FILE *f=NULL;  
    char * filename = "e:\\pics\\myData.h264";  
    f = fopen(filename, "wb");  
    if (!f)  
    {  
     printf( "could not open %s\n", filename);  
     exit(1);  
    }  

    //SwsContext  
    SwsContext * scxt = sws_getContext(c->width,c->height,PIX_FMT_BGR24,c->width,c->height,PIX_FMT_YUV420P,SWS_POINT,NULL,NULL,NULL);  

    AVPacket avpkt;  

    //AVFrame *pTFrame=new AVFrame  
    for (int i=0;i<60;++i)  
    {  
     //AVFrame *m_pYUVFrame = new AVFrame[1];  

     int index = (i / 5) % 5;  
     memcpy(rgb_buff,szTxt[index],nDataLen);  

     avpicture_fill((AVPicture*)m_pRGBFrame, (uint8_t*)rgb_buff, PIX_FMT_RGB24, nWidth, nHeight);  

     avpicture_fill((AVPicture*)m_pYUVFrame, (uint8_t*)yuv_buff, PIX_FMT_YUV420P, nWidth, nHeight);  

     m_pRGBFrame->data[0]  += m_pRGBFrame->linesize[0] * (nHeight - 1);  
     m_pRGBFrame->linesize[0] *= -1;                    
     m_pRGBFrame->data[1]  += m_pRGBFrame->linesize[1] * (nHeight / 2 - 1);  
     m_pRGBFrame->linesize[1] *= -1;  
     m_pRGBFrame->data[2]  += m_pRGBFrame->linesize[2] * (nHeight / 2 - 1);  
     m_pRGBFrame->linesize[2] *= -1;  


     sws_scale(scxt,m_pRGBFrame->data,m_pRGBFrame->linesize,0,c->height,m_pYUVFrame->data,m_pYUVFrame->linesize);  

     int got_packet_ptr = 0;  
     av_init_packet(&avpkt);  
     avpkt.data = outbuf;  
     avpkt.size = outbuf_size;  
     u_size = avcodec_encode_video2(c, &avpkt, m_pYUVFrame, &got_packet_ptr);  
     if (u_size == 0)  
     {  
      fwrite(avpkt.data, 1, avpkt.size, f);  
     }  
    }

    fclose(f);  
    delete []m_pRGBFrame;  
    delete []m_pYUVFrame;  
    delete []rgb_buff;  
    free(outbuf);  
    avcodec_close(c);  
    av_free(c);  
    }

    I want to use this code to record screen by encoding screenshots. what fps,gop size or other parameters i can use to reduce size of video.