Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (87)

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

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

Sur d’autres sites (11397)

  • ffmpeg decoding through C-API leads to artefacts when input resolution is 1200x1600. Am I doing something wrong ?

    26 février 2023, par Antonio

    Using the C-API and FFmpeg 5.1 I have been able to encode h264 videos with libx264 on Android.
Now I wanted to replay them on Linux inside my C++ application. These videos can be played correctly on a browser, or on other players that I tried like mplayer or ffplay from ffmpeg. Also, I can unroll the frames with ffmpeg -i recording.mp4 -start_number 0 -qscale:v 5 %06d.jpg and the images look alright.

    


    However in my C++ application every now and then, but in a very repeatable way, I get artifacts (like the bright pixels showing up above the monitor). They do not accumulate, even though they are not related to keyframes. So whatever error is going on, it doesn't seem to have an impact on subsequent frames. I use OpenCV to visualize the output, and I am pretty sure the problem is not the conversion to BGR because the artifact is already there if I simply show the y channel (luminance, grayscale).

    


    These artifacts show up in videos that I have recorded with a 1200x1600 resolution. It is to be noted that 1200 is not divisible by 32 so ffmpeg does add some padding, but I am dealing with it and it's not an issue. Videos recorded at 1920x1440 are replayed with no artifacts. Two sample videos can be found here for download.

    


    Here follows the code I am using, on the bottom you can see a picture of my decoded image with the artifact and the same as unrolled by ffmpeg command line. It should be noted that I am working with a custom built version of ffmpeg, out of conan packages, while the unrolling is done with ffmpeg from command line that comes with Ubuntu.

    


    extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;}&#xA;&#xA;#include &#xA;#include &#xA;#include &#xA;&#xA;#include <iostream>&#xA;int main(int argc, char** argv) {&#xA;&#xA;    int ret;&#xA;&#xA;    auto pkt = av_packet_alloc();&#xA;    if (!pkt) {&#xA;        std::cerr &lt;&lt; "Failed av_packet_alloc()" &lt;&lt; std::endl;&#xA;        exit(1);&#xA;    }&#xA;&#xA;    AVFormatContext* av_format = avformat_alloc_context();&#xA;    ret = avformat_open_input(&amp;av_format, FILE_NAME, nullptr, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "Failed avformat_open_input, Error: " &lt;&lt; ret &lt;&lt; std::endl;&#xA;        ///Error codes https://stackoverflow.com/questions/12780931/ffmpeg-exit-status-1094995529&#xA;        exit(1);&#xA;    }&#xA;    av_dump_format(av_format, 0, FILE_NAME, 0);&#xA;    auto video_st_number = av_find_best_stream(av_format, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);&#xA;    if (video_st_number &lt; 0) {&#xA;        std::cerr &lt;&lt; "av_find_best_stream couldn&#x27;t find video stream" &lt;&lt; std::endl;&#xA;        exit(1);&#xA;    }&#xA;    auto video_st = av_format->streams[video_st_number];&#xA;    auto codec_id = video_st->codecpar->codec_id;&#xA;    std::cout &lt;&lt; "Duration " &lt;&lt; video_st->duration &lt;&lt; std::endl;&#xA;    std::cout &lt;&lt; "n_frames " &lt;&lt; video_st->nb_frames &lt;&lt; std::endl;&#xA;&#xA;    auto frame = av_frame_alloc();&#xA;    if (!frame) {&#xA;        fprintf(stderr, "Could not allocate video frame\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    auto codec = avcodec_find_decoder(codec_id);&#xA;    if (!codec) {&#xA;        fprintf(stderr, "Codec not found\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    auto c = avcodec_alloc_context3(codec);&#xA;    if (!c) {&#xA;        fprintf(stderr, "Could not allocate video codec context\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;&#xA;    if ((ret = avcodec_parameters_to_context(c, video_st->codecpar))) {&#xA;        fprintf(stderr, "Failed avcodec_parameters_to_context\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    c->pix_fmt = AV_PIX_FMT_YUV420P;///Not really necessary&#xA;    c->thread_count = 1;///No impact&#xA;&#xA;    /* open it */&#xA;    if (avcodec_open2(c, codec, NULL) &lt; 0) {&#xA;        fprintf(stderr, "Could not open codec\n ");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    std::size_t counter = 0;&#xA;    std::size_t n_keyframes = 0;&#xA;&#xA;    while (ret >= 0) {&#xA;        ret = av_read_frame(av_format, pkt);&#xA;        if (pkt->size == 0) {&#xA;            std::cout &lt;&lt; "Skipping packet of size zero" &lt;&lt; std::endl;&#xA;            av_packet_unref(pkt);&#xA;            continue;&#xA;        }&#xA;        while (avcodec_send_packet(c, pkt) != 0) {&#xA;            if (avcodec_receive_frame(c, frame) != 0) {&#xA;                std::cerr &lt;&lt; "Error receiving frame" &lt;&lt; std::endl;&#xA;                exit(1);&#xA;            } else {&#xA;                n_keyframes &#x2B;= frame->key_frame;&#xA;                std::cout &lt;&lt; "Decoded " &lt;&lt; &#x2B;&#x2B;counter &lt;&lt; " frames. Frame No. " &lt;&lt; frame->pts / pkt->duration &lt;&lt; " "&#xA;                          &lt;&lt; frame->decode_error_flags &lt;&lt; " " &lt;&lt; frame->key_frame &lt;&lt; " " &lt;&lt; n_keyframes &lt;&lt; " "&#xA;                          &lt;&lt; frame->pkt_dts &lt;&lt; std::endl;&#xA;            }&#xA;            display(frame);&#xA;        }&#xA;        av_packet_unref(pkt);&#xA;    }&#xA;&#xA;    avcodec_send_packet(c, nullptr);&#xA;    std::cout &lt;&lt; "Flushing decoder" &lt;&lt; std::endl;&#xA;&#xA;    while (avcodec_receive_frame(c, frame) == 0) {&#xA;        n_keyframes &#x2B;= frame->key_frame;&#xA;        std::cout &lt;&lt; "Decoded " &lt;&lt; &#x2B;&#x2B;counter &lt;&lt; " frames. Frame No. " &lt;&lt; frame->pts &lt;&lt; " " &lt;&lt; frame->decode_error_flags&#xA;                  &lt;&lt; " " &lt;&lt; frame->key_frame &lt;&lt; " " &lt;&lt; n_keyframes &lt;&lt; " " &lt;&lt; frame->pkt_dts &lt;&lt; std::endl;&#xA;&#xA;        display(frame);&#xA;    }&#xA;&#xA;    avcodec_free_context(&amp;c);&#xA;    avformat_free_context(av_format);&#xA;    av_frame_free(&amp;frame);&#xA;    av_packet_free(&amp;pkt);&#xA;&#xA;    return 0;&#xA;}&#xA;</iostream>

    &#xA;

    Picture as from my encoder&#xA;Picture from ffmpeg command line unrolling

    &#xA;

    For completeness, this is the display function, using openCV

    &#xA;

    void display(const AVFrame* frame) {&#xA;    static std::vector yuv_buffer;&#xA;    yuv_buffer.resize(frame->linesize[0] * 3 / 2 * frame->width);&#xA;    cv::Mat mYUV(frame->height * 3 / 2, frame->width, CV_8UC1, yuv_buffer.data(), frame->linesize[0]);&#xA;    memcpy(mYUV.ptr(), frame->data[0], frame->linesize[0] * frame->height);&#xA;    //cv::imshow("grayscale", mYUV.rowRange(0, frame->height));&#xA;    //cv::imshow("u", cv::Mat(frame->height / 2, frame->width / 2, CV_8UC1, frame->data[1], frame->linesize[1]));&#xA;    //cv::imshow("v", cv::Mat(frame->height / 2, frame->width / 2, CV_8UC1, frame->data[2], frame->linesize[2]));&#xA;&#xA;    int dest_row = frame->height;&#xA;    for (int j = 0; j &lt; frame->height / 2; j&#x2B;&#x2B;) {&#xA;        memcpy(mYUV.ptr(dest_row), frame->data[1] &#x2B; frame->linesize[1] * j, frame->width);&#xA;        j&#x2B;&#x2B;;&#xA;        memcpy(mYUV.ptr(dest_row) &#x2B; frame->width / 2, frame->data[1] &#x2B; frame->linesize[1] * j, frame->width);&#xA;        dest_row&#x2B;&#x2B;;&#xA;    }&#xA;    for (int j = 0; j &lt; frame->height / 2; j&#x2B;&#x2B;) {&#xA;        memcpy(mYUV.ptr(dest_row), frame->data[2] &#x2B; frame->linesize[2] * j, frame->width);&#xA;        j&#x2B;&#x2B;;&#xA;        memcpy(mYUV.ptr(dest_row) &#x2B; frame->width / 2, frame->data[2] &#x2B; frame->linesize[2] * j, frame->width);&#xA;        dest_row&#x2B;&#x2B;;&#xA;    }&#xA;    cv::Mat mRGB(frame->height, frame->width, CV_8UC3);&#xA;    cvtColor(mYUV, mRGB, cv::COLOR_YUV2BGR_I420, 3);&#xA;    cv::imshow("Video", mRGB);&#xA;    cv::waitKey(0);&#xA;}&#xA;

    &#xA;


    &#xA;

    Note : The AVFrame -> cv::Mat converter is now available in corrected version as answer here.

    &#xA;

  • Transcoding to a dnxhd .mxf files will change resolution to 1088p, any chance of geting a 1080p file instead ?

    27 février 2023, par willjonesvfx

    Exporting to a .mov file will give me a 1920x1080p file as required&#xA;However the exact same code exporting to a .mxf will actually export a 1920x1088p file which breaks our pipeline.

    &#xA;

    ffmpeg - start_number 1000 -i -inputfile%4d.tiff -c:v dnxhd -r 24 -b:v115M -pix_fmt yuv422p outputfile.mxf&#xA;

    &#xA;

    Any help would be appreciated !

    &#xA;

    Thanks&#xA;Will

    &#xA;

    I have tried to set the scale etc and it doesn't change anything. Has anyone ever seen this before and if so is there a fix ? At this point i may report this as a bug !

    &#xA;

  • why reducing the resolution a percentage doesn't reduce the video the same proportion using ffmpeg ?

    14 mars 2023, par user44551

    I'm using this command :

    &#xA;

    -y -r -i $inVideoUri -movflags faststart -c:v libx265 -s $videoResolution -c:a copy -preset ultrafast $outPutUri"&#xA;

    &#xA;

    However, if "videoResolution" is a 50% of the original video resolution, the resulting file size is not 50% of the original one. I assume there are some headers or metadata added during the process but I would like to know how to estimate the final video size.

    &#xA;