Recherche avancée

Médias (1)

Mot : - Tags -/ogg

Autres articles (68)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

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

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (8039)

  • libx264 encoder video plays too fast

    23 avril 2014, par Nick

    I’m trying to write a program that uses libx264 to encode the video frames. I’ve wrapped this code into a small class (see below). I have frames that are in YUV420 format. libx264 encodes the frames and I save them to a file. I can play the file back in VLC, all of the frames are there, but it plays back at several hundred times the actual frame rate. Currently I am capturing frames at 2.5 FPS, but they play back as if it was recorded at 250 or more FPS. I’ve tried to change the frame rate with no luck.

    I’ve also tried to set

    _param.b_vfr_input = 1

    and then set the time bases appropriately, but that causes my program to crash. Any ideas ? My encode code is shown below. I’ve also included the output of ffprobe -show_frames

    Wrapper Class :

    x264wrapper::x264wrapper(int width, int height, int fps, int timeBaseNum, int timeBaseDen, int vfr)
    {
       x264_param_default_preset(&_param, "veryfast", "zerolatency");
       _param.i_threads = 1;
       _param.i_width = width;
       _param.i_height = height;
       _param.i_fps_num = fps;
       _param.i_fps_den = 1;
       // Intra refres:
       _param.i_keyint_max = fps;
       _param.b_intra_refresh = 1;
       //Rate control:
       _param.rc.i_rc_method = X264_RC_CRF;
       //_param.rc.i_rc_method = X264_RC_CQP;
       _param.rc.f_rf_constant = 25;
       _param.rc.f_rf_constant_max = 35;
       //For streaming:
       _param.b_repeat_headers = 1;
       _param.b_annexb = 1;    
       // misc
       _param.b_vfr_input = vfr;
       _param.i_timebase_num = timeBaseNum;
       _param.i_timebase_den = timeBaseDen;

       _param.i_log_level = X264_LOG_DEBUG;

       _encoder = x264_encoder_open(&_param);

       cout << "Timebase " << _param.i_timebase_num << "/" << _param.i_timebase_den << endl;
       cout << "fps " << _param.i_fps_num << "/" << _param.i_fps_den << endl;
       _ticks_per_frame = (int64_t)_param.i_timebase_den * _param.i_fps_den / _param.i_timebase_num / _param.i_fps_num;
       cout << "ticks_per_frame " << _ticks_per_frame << endl;
       int result = x264_picture_alloc(&_pic_in, X264_CSP_I420, width, height);
       if (result != 0)
       {
           cout << "Failed to allocate picture" << endl;
           throw(1);
       }

       _ofs = new ofstream("output.h264", ofstream::out | ofstream::binary);
       _pts = 0;
    }


    x264wrapper::~x264wrapper(void)
    {
       _ofs->close();
    }



    void x264wrapper::encode(uint8_t * buf)
    {
       x264_nal_t* nals;
       int i_nals;
       convertFromBalserToX264(buf);
       _pts += _ticks_per_frame;
       _pic_in.i_pts = _pts;
       x264_picture_t pic_out;
       int frame_size = x264_encoder_encode(_encoder, &nals, &i_nals, &_pic_in, &pic_out);
       if (frame_size >= 0)
       {
           _ofs->write((char*)nals[0].p_payload, frame_size);
       }
       else
       {
           cout << "error: x264_encoder_encode failed" << endl;
       }
    }

    Output of ffprobe -show_frames :

    [FRAME]
    media_type=video
    key_frame=1
    pkt_pts=N/A
    pkt_pts_time=N/A
    pkt_dts=N/A
    pkt_dts_time=N/A
    pkt_duration=48000
    pkt_duration_time=0.040000
    pkt_pos=0
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=I
    coded_picture_number=0
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    reference=0
    [/FRAME]
    [FRAME]
    media_type=video
    key_frame=0
    pkt_pts=N/A
    pkt_pts_time=N/A
    pkt_dts=N/A
    pkt_dts_time=N/A
    pkt_duration=N/A
    pkt_duration_time=N/A
    pkt_pos=54947
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=P
    coded_picture_number=1
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    reference=0
    [/FRAME]
    [FRAME]
    media_type=video
    key_frame=0
    pkt_pts=N/A
    pkt_pts_time=N/A
    pkt_dts=N/A
    pkt_dts_time=N/A
    pkt_duration=N/A
    pkt_duration_time=N/A
    pkt_pos=57899
    width=1920
    height=1080
    pix_fmt=yuv420p
    sample_aspect_ratio=N/A
    pict_type=P
    coded_picture_number=2
    display_picture_number=0
    interlaced_frame=0
    top_field_first=0
    repeat_pict=0
    reference=0
    [/FRAME]
  • ffmpeg used vda from os x

    13 mai 2014, par user2618420

    I try to enable hardware decoding project earlier decoded using ffmpeg

    ffmpeg has support in hard-copy decoding
    Here documentation kotoroya I did https://github.com/dilaroga/ffmpeg-vda/wiki/FFmpeg-vda-usage
    my code

    enum AVPixelFormat myGetFormatCallback(struct AVCodecContext *ctx, const enum AVPixelFormat * fmt)
    {
       struct vda_context *vda_ctx;
       vda_ctx = (struct vda_context *)malloc(sizeof(vda_context));
       vda_ctx->decoder = NULL;
       vda_ctx->width = ctx->width;
       vda_ctx->height = ctx->height;
       vda_ctx->format = 'avc1';
       vda_ctx->use_ref_buffer = 1;
       switch (ctx->pix_fmt) {
           case PIX_FMT_UYVY422:{
               vda_ctx->cv_pix_fmt_type = '2vuy';
               break;
           }
           case PIX_FMT_YUYV422:{
               vda_ctx->cv_pix_fmt_type = 'yuvs';
               break;
           }
           case PIX_FMT_NV12:{
               vda_ctx->cv_pix_fmt_type = '420v';
               break;
           }
           case PIX_FMT_YUV420P:{
               vda_ctx->cv_pix_fmt_type = 'y420';
               break;
           }
           default:{
               av_log(ctx, AV_LOG_ERROR, "Unsupported pixel format: %d\n", ctx->pix_fmt);
               Logger::debug(LOG_LEVEL_ERROR, "Unsupported pixel format: %d", ctx->pix_fmt);
               throw AbstractException("Unsupported pixel format");
           }
        }
       int status = ff_vda_create_decoder(vda_ctx, (unsigned char*)ctx->extradata,ctx->extradata_size);
       if (status){
           Logger::debug(LOG_LEVEL_ERROR, "Error create VDA decoder");
           throw AbstractException("Error create VDA decoder");
       }else{
           ctx->hwaccel_context = vda_ctx;
       }

       return ctx->pix_fmt;
    }

    static void release_vda_context(void *opaque, uint8_t *data)
    {
       vda_buffer_context *vda_context = (vda_buffer_context *)opaque;
       av_free(vda_context);
    }

    int myGetBufferCallback(struct AVCodecContext *s, AVFrame *av_frame, int flags)
    {
       vda_buffer_context *vda_context = (vda_buffer_context *)av_mallocz(sizeof(*vda_context));
       AVBufferRef *buffer = av_buffer_create(NULL, 0, release_vda_context, vda_context, 0);

       if( !vda_context || !buffer )
       {
           av_free(vda_context);
           return -1;
       }

       av_frame->buf[0] = buffer;
       av_frame->data[0] = (uint8_t*)1;
       return 0;
    }


    static void release_buffer(struct AVCodecContext *opaque, AVFrame *pic)
    {
       vda_buffer_context *context = (vda_buffer_context*)opaque;
       CVPixelBufferUnlockBaseAddress(context->cv_buffer, 0);
       CVPixelBufferRelease(context->cv_buffer);
       av_free(context);
    }

    main(){
       //init ff context
       if (avcodec_open2(mCodecContext, mCodec, NULL) < 0) throw AbstractException("Unable to open codec");

       mCodecContext->get_format = myGetFormatCallback;
       mCodecContext->get_buffer2 = myGetBufferCallback;
       mCodecContext->release_buffer = release_buffer;
    }

    but I did not myGetFormatCallback the method is called, and called myGetBufferCallback falls
    why not called myGetFormatCallback ? what’s wrong ? may not work well at all

  • Extract audio from video in mp3 format using android-ffmpeg-library

    28 mai 2014, par user2870161

    I want extrat audio from any type of video file and save it in mp3 format using android-ffmpeg-library.

    My most of work is done here i am create wav file using this code but problame is when i create mp3 file it make only 0kb file in sdcard.

    I hope I’ve made myself clear, and thanks for taking the time to read this.

       if (inputPath == null || outputPath == null) {
           throw new IllegalStateException("Need an input and output filepath!");
       }  

       final List<string> cmd = new LinkedList<string>();


       String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
       String fileName = "3.mp4";
       String fileName1 = "2.mp3";

       String path  = baseDir + "/" + fileName;
       String path1  = baseDir + "/" + fileName1;

         File f = new File(path);

         if(f.exists()){
             System.out.println("File existed");
         }else{
             System.out.println("File not found!");
         }

         cmd.add(mFfmpegPath);
         cmd.add("-i");
         cmd.add(path);

         cmd.add("-vn");
         cmd.add("-acodec");
         cmd.add("copy");

         cmd.add(path1);








       final ProcessBuilder pb = new ProcessBuilder(cmd);
       return new ProcessRunnable(pb);
    </string></string>