Recherche avancée

Médias (0)

Mot : - Tags -/publication

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

Autres articles (90)

  • 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

  • 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 (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (9166)

  • Convert opencv mat frame to ffmpeg AVFrame

    1er avril 2015, par Yoohoo

    I am currently work on a c++ real-time video transmission project, now I am using opencv to capture the webcam, and I want to convert the opencv Mat to ffmepg AVFrame to do the encoding and write into buffer. At the decoder side, read packet from buffer, using ffmpeg decode, and then convert ffmpeg AVFrame to opencv Mat again and play.

    Now I have finished the opencv capturing, and I can encode v4l2 source with ffmpeg, but what I want to do is replace the v4l2 source with opencv Mat. But it get error in follow code (I just show the part of the conversion) :

       Mat opencvin;                    //frame from webcam
       cap.read(opencvin);

       Mat* opencvframe;
       opencvframe = &opencvin;
       AVFrame ffmpegout;
       Size frameSize = opencvframe->size();
       AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
       AVFormatContext* outContainer = avformat_alloc_context();
       AVStream *outStream = avformat_new_stream(outContainer, encoder);
       avcodec_get_context_defaults3(outStream->codec, encoder);

       outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
       outStream->codec->width = opencvframe->cols;
       outStream->codec->height = opencvframe->rows;
       avpicture_fill((AVPicture*)&ffmpegout, opencvframe->data, PIX_FMT_BGR24, outStream->codec->width, outStream->codec->height);
       ffmpegout.width = frameSize.width;
       ffmpegout.height = frameSize.height;

    This is a code I borrow from Internet, it seems the frame have already be encoded during conversion, before I use

    static AVCodecContext *c= NULL;

    c = avcodec_alloc_context3(codec);
    if (!c) {
       fprintf(stderr, "Could not allocate video codec context\n");
       exit(1);
    }
    c->bit_rate = 400000;
    /* resolution must be a multiple of two */
    c->width = 640;
    c->height = 480;
    /* frames per second */
    c->time_base= (AVRational){1,25};
    c->gop_size = 10; /* emit one intra frame every ten frames */
    c->max_b_frames=15;
    c->pix_fmt = AV_PIX_FMT_YUV420P;

    ret = avcodec_encode_video2(c, &pkt, &ffmpegout, &got_output);

    to encode the frame. And I get core dumped error if I continue encode the converted frame.

    I want encode the frame after conversion so that I can keep the data in pkt. How can I get a pure converted ffmpeg frame from opencv frame ?

    Or if the encode have already done during coversion, how can I get the output into pkt ?

  • avcodec_open segmentation fault

    24 juin 2014, par user3715403

    Good afternoon,

    I got a copy of the ffmpeg’s api-example.c (https://www.ffmpeg.org/doxygen/0.6/api-example_8c-source.html). I tested the function video_encode_example() and got the code working as expected.

    I then re-factored this function into different class methods and now I get a seg fault with the call to avcodev_open(). I then changed the code to call the original video_encode_example() from a class method and the calls to avcodec... were successful.

    It appears that when called from a function (eg video_encode_example()), the behaviour is as expected, but avcodev_open fails when called from a class method. I traced the code and in both cases the values for the avcodev_open() arguments are assigned (and similar) pointer values. cgdb reports that the seg fault occurs in avcodev_open2()

    Any suggestions ?
    The code was compiled and tested on a Ubuntu 12.04 64 bit machine) using the libav package available thru apt-get (libavcodec.so.53.35.0)

    Regards,
    Daniel

    Added comment following the first response :

    From the link above, I copied the function video_encode_example() and placed the call inside a class constructor. This part is working.

    VideoEncoder::VideoEncoder( const std::string& aFileName)
       : mCodec( NULL)
       , mCodecContext( NULL)
       , picture (NULL)
       , mFileName( aFileName)
       , mFileHandler( NULL)
    {
       // must be called before using avcodec lib
       ::avcodec_init();

       // register all the codecs
       ::avcodec_register_all();

       video_encode_example( aFileName.c_str());
       return;
       ...
    }

    The re-factored part includes splitting the avcodev call (from the original video_encode_example() function) to different VideoEncoder methods. The constructor now looks like :

    VideoEncoder::VideoEncoder( const std::string& aFileName)
       : mCodec( NULL)
       , mCodecContext( NULL)
       , picture (NULL)
       , mFileName( aFileName)
       , mFileHandler( NULL)
    {
       // must be called before using avcodec lib
       ::avcodec_init();

       // register all the codecs
       ::avcodec_register_all();

       // find the mpeg1 video encoder
       mCodec = ::avcodec_find_encoder( CODEC_ID_MPEG1VIDEO);
       if (!mCodec) {
           fprintf( stderr, "codec not found\n");
           exit( 1);
       }

       mCodecContext = ::avcodec_alloc_context3( mCodec);
       picture = ::avcodec_alloc_frame();

       // put sample parameters
       mCodecContext->bit_rate = 400000;

       // frames per second
       mCodecContext->time_base = (AVRational){1,25};
       mCodecContext->gop_size = 10;               // emit one intra frame every ten frames
       mCodecContext->max_b_frames = 1;
       mCodecContext->pix_fmt = PIX_FMT_YUV420P;

       // open it
       // Initializes the AVCodecContext to use the given AVCodec. Prior to using this function the context has to be allocated.
       if (::avcodec_open( mCodecContext, mCodec) < 0) {
           fprintf(stderr, "could not open codec\n");
           exit( 1);
       }

       mFileHandler = fopen( mFileName.c_str(), "wb");
       if (!mFileHandler) {
           fprintf( stderr, "could not open %s\n", mFileName.c_str());
           exit( 1);
       }

    }

    The call to avcodec_open causes the seg fault. In addition, the fault occurs whether using avcodev_.. or ::avcodev_...

  • FFMPEG HLS stream for Android and IOS

    26 février 2015, par Poda

    I’m trying to stream to mobile devices with ffmpeg and apache2.2 but I haven’t been successful.

    I used this command to create the segments and the playlist :

    ffmpeg -i http://x.x.x.x:8080 -codec:v libx264 -r 25 -pix_fmt yuv420p -profile:v baseline -level 3 -b:v 500k -s 640x480 -codec:a aac -strict experimental -ac 2 -b:a 128k -movflags faststart -flags -global_header -map 0 -f hls  -hls_time 10 -hls_list_size 5 -hls_allow_cache 0 -sc_threshold 0 -hls_flags delete_segments -hls_segment_filename out%05d.ts list.m3u8

    The source is a http stream which is streamed by VLC media player.

    Example content of the list.m3u8 file :

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-ALLOW-CACHE:NO
    #EXT-X-TARGETDURATION:10
    #EXT-X-MEDIA-SEQUENCE:89
    #EXTINF:10.000000,
    out00089.ts
    #EXTINF:10.000000,
    out00090.ts
    #EXTINF:10.000000,
    out00091.ts
    #EXTINF:10.000000,
    out00092.ts
    #EXTINF:9.000000,
    out00093.ts
    #EXT-X-ENDLIST

    I created another playlist file - playlist.m3u8 :

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=512000
    http://x.x.x.x/list.m3u8

    If I open this (playlist.m3u8) file in VLC media player then it plays.
    It also works in desktop chrome and desktop firefox browsers with Video-js plugin flash fallback.

    I set the correct MIME types to the .ts and .m3u8 files in .htaccess file :

    AddType application/x-mpegURL .m3u8
    AddType video/MP2T .ts

    FFprobe output for playlist.m3u8 :

    Input #0, hls,applehttp, from 'playlist.m3u8':
       Duration: N/A, start: 1.400000, bitrate: N/A
       Program 0
       Metadata: variant_bitrate : 512000
    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Metadata: variant_bitrate : 512000
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata: variant_bitrate : 512000

    What should I do to make it work ?

    UPDATE

    It works if I provide a link to list.m3u8 file (created by ffmpeg).