Recherche avancée

Médias (0)

Mot : - Tags -/flash

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

Autres articles (63)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (11145)

  • Why decoding frames from avi container and encode them to h264/mp4 doesn't work ?

    28 novembre 2013, par theateist

    I started using ffmpeg and I want to convert avi file to mp4/h264 file. I've read many posts including this, but I couldn't find any good example how to save frames to mp4 file. The code below is simplified one that decodes frames from avi file and encode it to H264/mp4 file, but when I save the frames the mp4 file cannot be played. I think I do somethinkg wrong in encoding

    I will appreciate if you could tell me what is wrong and how to fix it.

    const char* aviFileName = "aviFrom.avi";
    const char* mp4FileName = "mp4To.mp4";

    // Filling pFormatCtx by open video file and Retrieve stream information
    // ...
    // Retrieving codecCtxDecode and opening codecDecode
    //...


    // Get encoder
    codecCtxEncode = avcodec_alloc_context();  
    codecCtxEncode->qmax = 69;
    codecCtxEncode->max_qdiff = 4;
    codecCtxEncode->bit_rate = 400000;
    codecCtxEncode->width = codecCtxDecode->width;
    codecCtxEncode->height = codecCtxDecode->height;
    codecCtxEncode->pix_fmt = AV_PIX_FMT_YUV420P;  
    codecEncode = avcodec_find_encoder(CODEC_ID_H264);
    if(codecEncode == NULL)
       return -1;  
    if(avcodec_open2(codecCtxEncode, codecEncode, NULL))
       return -1;

    SwsContext *sws_ctx = sws_getContext(codecCtxDecode->width, codecCtxDecode->height, codecCtxDecode->pix_fmt,
                               codecCtxDecode->width, codecCtxDecode->height, AV_PIX_FMT_YUV420P,
                               SWS_BILINEAR, NULL, NULL, NULL);

    // Allocate an AVFrame structure    
    frameDecoded = avcodec_alloc_frame();
    frameEncoded = avcodec_alloc_frame();    

    avpicture_alloc((AVPicture *)frameEncoded, AV_PIX_FMT_YUV420P, codecCtxDecode->width, codecCtxDecode->height);

    while(av_read_frame(pFormatCtx, &packet)>=0)
    {      
       // Is this a packet from the video stream?
       if(packet.stream_index==videoStreamIndex) {
           avcodec_decode_video2(codecCtxDecode, frameDecoded, &frameFinished, &packet);
           // Did we get a video frame?
           if(frameFinished)
           {          
               fwrite(packet.data, packet.size,
               sws_scale(sws_ctx, frameDecoded->data, frameDecoded->linesize, 0, codecCtxDecode->height,
                           frameEncoded->data, frameEncoded->linesize);



               int64_t pts = packet.pts;
               av_free_packet(&packet);
               av_init_packet(&packet);
               packet.data = NULL;
               packet.size = 0;    
               frameEncoded->pts = pts;                

               int failed = avcodec_encode_video2(codecCtxEncode, &packet, frameEncoded, &got_output);
               if(failed)
               {
                   exit(1);
               }
               fwrite(packet.data,1,packet.size, mp4File);
           }
       }

       av_free_packet(&packet);
    }
  • Encode image to video using ffmpeg (sws_scale)

    26 septembre 2012, par bahar_p

    I'm trying to encode an image to video using ffmpeg library.
    I have these global params :

    //Global params
    AVCodec         *codec;
    AVCodecContext  *codecCtx;
    uint8_t         *output_buffer;
    int             output_buffer_size;

    I divided the encoding to 3 methods :
    Initialize the encoder :

    jint Java_com_camera_simpledoublewebcams2_CameraPreview_initencoder(JNIEnv* env,jobject thiz){
    avcodec_register_all();
    avcodec_init();
    av_register_all();

    int fps = 30;

    /* find the H263 video encoder */
    codec = avcodec_find_encoder(CODEC_ID_H263);
    if (!codec) {
       LOGI("avcodec_find_encoder() run fail.");
       return -5;
    }

    //allocate context
    codecCtx = avcodec_alloc_context();

    /* put sample parameters */
    codecCtx->bit_rate = 400000;
    /* resolution must be a multiple of two */
    codecCtx->width = 176;
    codecCtx->height = 144;
    /* frames per second */
    codecCtx->time_base = (AVRational){1,fps};
    codecCtx->pix_fmt = PIX_FMT_YUV420P;
    codecCtx->codec_id = CODEC_ID_H263;
    codecCtx->codec_type = AVMEDIA_TYPE_VIDEO;

    /* open it */
    if (avcodec_open(codecCtx, codec) < 0) {
       LOGI("avcodec_open() run fail.");
       return -10;
    }

    //init buffer
    output_buffer_size = 500000;
    output_buffer = malloc(output_buffer_size);

    return 0;

    }

    Encoding the image :

    jint Java_com_camera_simpledoublewebcams2_CameraPreview_encodejpeg(JNIEnv* env,jobject thiz,jchar* cImage, jint imageSize){
    int             out_size;
    AVFrame         *picture;
    AVFrame         *outpic;
    uint8_t         *outbuffer;

    //allocate frame    
    picture = avcodec_alloc_frame();    
    outpic = avcodec_alloc_frame();

    int nbytes = avpicture_get_size(PIX_FMT_YUV420P, codecCtx->width, codecCtx->height);
    outbuffer = (uint8_t*)av_malloc(nbytes);
    outpic->pts = 0;

    //fill picture with image
    avpicture_fill((AVPicture*)picture, (uint8_t*)cImage, PIX_FMT_RGBA, codecCtx->width, codecCtx->height);
    //fill outpic with empty image
    avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, codecCtx->width, codecCtx->height);

    //rescale the image
    struct SwsContext* fooContext = sws_getContext(codecCtx->width, codecCtx->height,
                                                          PIX_FMT_RGBA,
                                                          codecCtx->width, codecCtx->height,
                                                          PIX_FMT_YUV420P,
                                                          SWS_FAST_BILINEAR, NULL, NULL, NULL);
    sws_scale(fooContext, picture->data, picture->linesize, 0, codecCtx->height, outpic->data, outpic->linesize);  

    //encode the image
    out_size = avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, outpic);
    out_size += avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, outpic);

    //release pictures
    av_free(outbuffer);
    av_free(picture);
    av_free(outpic);

    return out_size;

    }

    And closing the encoder :

    void Java_com_camera_simpledoublewebcams2_CameraPreview_closeencoder(JNIEnv* env,jobject thiz){
    free(output_buffer);
    avcodec_close(codecCtx);
    av_free(codecCtx);

    }

    When I send the first image, I get a result from the encoder. When I try to send another image the program crashes.
    I tried calling init once and then the images, then the close - didn't work.
    I tried calling the init and the close for every image - didn't work.

    Any suggestions ?

    Thanks !

    EDIT : After further research I found that the problem is at sws_scale method.
    Still don't know what is causing this issue...

  • screenrecorder appliaction. video output size issues [closed]

    25 juin 2022, par jNc

    Having working github project
https://github.com/abdullahfarwees/screen-recorder-ffmpeg-cpp

    


    All works perfectly fine, but output video resolution is not correct
I need to change output video resolution

    


    Using ubuntu/gcc/opencv/

    


    [...]
outAVCodecContext->bit_rate = 400000; // 2500000
outAVCodecContext->width = 1920; // <- change this one
outAVCodecContext->height = 1080; // <- and also this one
outAVCodecContext->gop_size = 3;
[...]