Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (41)

  • 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 Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

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

Sur d’autres sites (2748)

  • Add padding with ffmpeg to videos increases file size, why ?

    12 mars 2023, par try2getsmarter

    I need to add padding to mp4 video files (since tv changes aspect ratio on playback) and I simply can do this with -pad option of ffmpeg.

    


    The output is ok for me, but I see that most of the video files increase about 25%-30% in file size.

    


    ffmpeg -i in.mp4 -preset slow -vf "pad=1920:1080 :(1920-iwmin(1920/iw,1080/ih))/2 :(1080-ihmin(1920/iw,1080/ih))/2" -c:v h264 -c:a copy out_fhd.mp4"

    


    Is there a way to preserve the input quality and have the same file size ? As the black bars contain no information I had the expectation that there is a lossless mode to take the already H264 encoded stream and just add blocks with black pixels.

    


  • libvlc ffmpeg : No seek in mpegts h264 stream

    26 juillet 2016, par ElDorado

    I am using ffmpeg to record video input from GDI (windows screen recorder) to view it later using VLC (via ActiveX plugin) + ffmpeg to decode it.

    Right now seeking in video is not working in VLC via plugin (which is critical). VLC player itself provide seeking, but it is more like byte position seeking (on I- frames which are larger than other frames it makes larger steps on horizontal scroll and also there are no timestamps).

    Encoder is opened with next defaults :

    avformat_alloc_output_context2(&outputContext, NULL, "mpegts", "test.mpg");
    outputFormat = outputContext->oformat;
    encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
    outputStream = avformat_new_stream(outputContext, encoder);
    outputStream->id = outputContext->nb_streams - 1;
    encoderContext = outputStream->codec;
    encoderContext->bit_rate = bitrate;   // 800000 by default
    encoderContext->rc_max_rate = bitrate;
    encoderContext->width = imageWidth;   // 1920
    encoderContext->height = imageHeight; // 1080
    encoderContext->time_base.num = 1;
    encoderContext->time_base.den = fps;  // 25 by default
    encoderContext->gop_size = fps;
    encoderContext->keyint_min = fps;
    encoderContext->max_b_frames = 0;
    encoderContext->pix_fmt = AV_PIX_FMT_YUV420P;
    outputStream->time_base = encoderContext->time_base;
    avcodec_open2(encoderContext, encoder, NULL);

    Recording is done this way :

    // my impl of GDI recorder, returning AVFrame with only data and linesize filled.
    AVFrame* tmp_frame = impl_->recorder->acquireFrame();

    // converting RGB -> YUV420
    sws_scale(impl_->scaleContext, tmp_frame->data, tmp_frame->linesize, 0, impl_->frame->height, impl_->frame->data, impl_->frame->linesize);

    // pts variable is calculated by using QueryPerformanceCounter form WinAPI. It is strictly increasing
    impl_->frame->pts = pts;

    avcodec_encode_video2(impl_->encoderContext, impl_->packet, impl_->frame, &out_size);

    if (out_size) {
        impl_->packet->pts = pts;
        impl_->packet->dts = pts;
        impl_->packet->duration = 1; // here it is! It is set but has no effect
        av_packet_rescale_ts(impl_->packet, impl_->encoderContext->time_base, impl_->outputStream->time_base);
        // here pts = 3600*pts, dts = 3600*pts, duration = 3600 what I consider to be legit in terms of milliseconds
        impl_->packet->stream_index = impl_->outputStream->index;
        av_interleaved_write_frame(impl_->outputContext, impl_->packet);
        av_packet_unref(impl_->packet);
        out_size = 0;
    }

    ffprobe is providing next info on frames :

    [FRAME]
    media_type=video
    stream_index=0
    key_frame=1
    pkt_pts=3600
    pkt_pts_time=0:00:00.040000
    pkt_dts=3600
    pkt_dts_time=0:00:00.040000
    best_effort_timestamp=3600
    best_effort_timestamp_time=0:00:00.040000
    pkt_duration=N/A
    pkt_duration_time=N/A
    pkt_pos=564
    pkt_size=97.018555 Kibyte
    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
    [/FRAME]

    I believe that problem is in pkt_duration variable, though it was set.
    What I am doing wrong in recording so I can’t seek in video ?

    P.S. on other videos (also h264) seeking is working in ActiveX VLC plugin.

  • FFMPEG avformat_open_input returning AVERROR_INVALIDDATA [on hold]

    10 août 2016, par Victor.dMdB

    I’m trying to use ffmpeg to take in video data from a buffer but keep on getting the same error.

    I’ve implemented the same code as described here :
    http://www.ffmpeg.org/doxygen/trunk/doc_2examples_2avio_reading_8c-example.html

    Here is the code (I’ve tried removing the unnecessary bits)

    VideoInputFile *video_input_file;
    VideoDataConf *video_data_conf;

    video_data_conf->width = 1920;
    video_data_conf->height = 1080;

    int vbuf_size = 9 * cmd_data_ptr->video_data_conf.width * cmd_data_ptr->video_data_conf.height + 10000;
    uint8_t *buffer = (uint8_t *) av_malloc(vbuf_size);

    video_data_conf->input_ptr.ptr = buffer;
    video_data_conf->input_ptr.size = vbuf_size;
    strncpy(video_data_conf->filename, "localmem");

    video_input_file->vbuf_size = 9 * video_data_conf->width * video_data_conf->height + 10000;
    video_input_file->vbuf = (uint8_t *) av_malloc(video_input_file->vbuf_size);
    video_input_file->av_io_ctx = avio_alloc_context(video_input_file->vbuf, video_input_file->vbuf_size, 0, &video_data_conf->input_ptr, &read_function, NULL, NULL);

    if ( !video_input_file->av_io_ctx ) {
       fprintf(stdout,"Failed to create the buffer avio context\n");
    }

    video_input_file->av_fmt_ctx = avformat_alloc_context();

    if ( !video_input_file->av_fmt_ctx ) {
       printf(stdout,"Failed to create the video avio context\n");
    }

    video_input_file->av_fmt_ctx->pb = video_input_file->av_io_ctx;

    open_res = avformat_open_input(&video_input_file->av_fmt_ctx, video_data_conf->filename, NULL, NULL);

    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;
       bd->size -= buf_size;
       return buf_size;
    }

    BufferData structure

    typedef struct {
       uint8_t *ptr;
       size_t size; ///< size left in the buffer
    } BufferData;

    It starts to work if I initialise the buffer and vbuf_size with a real file like so :

     uint8_t *buffer;
     size_t vbuf_size;
     av_file_map("/path/to/image.png", &buffer, &vbuf_size, 0, NULL);