Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (80)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (14961)

  • FFmpeg : Encoder did not produce proper pts, making some up

    22 novembre 2022, par Chroluma

    I'm trying to convert a yuv image to jpg format via FFmpeg. But I occured [image2 @ 0x38750] Encoder did not produce proper pts, making some up. while the program was encoding. I looked up some references that someone said avcodec_send_frame can only be used when the frames is more than one. Can I use this way to achieve image conversion ? Here is my code :

    


    int ff_yuv422P_to_jpeg(int imgWidth, int imgHeight, uint8_t* yuvData, int yuvLength)
{
    /* ===== define ===== */
    const char* OutputFileName = "img.jpg";
    int retval = 0;

    /* ===== context ===== */
    struct AVFormatContext* pFormatCtx = avformat_alloc_context();
    avformat_alloc_output_context2(&pFormatCtx, NULL, NULL, OutputFileName);
    struct AVOutputFormat* fmt = pFormatCtx->oformat;

    struct AVStream* video_st = avformat_new_stream(pFormatCtx, 0);
    if (!video_st)
    {
        retval = 1;
        perror("ff_yuv422_to_jpeg(): avformat_new_stream");
        goto out_close_ctx;
    }

    /* ===== codec ===== */
    struct AVCodecContext* pCodecCtx = avcodec_alloc_context3(NULL);
    if (avcodec_parameters_to_context(pCodecCtx, video_st->codecpar) < 0)
    {
        retval = 2;
        perror("ff_yuv422_to_jpeg(): avcodec_parameters_to_context");
        goto out_close_ctx;
    }

    pCodecCtx->codec_id = fmt->video_codec;
    pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
    pCodecCtx->pix_fmt = AV_PIX_FMT_YUVJ422P;
    pCodecCtx->width = imgWidth;
    pCodecCtx->height = imgHeight;
    pCodecCtx->time_base.num = 1;
    pCodecCtx->time_base.den = 25;

    //dump info
    av_dump_format(pFormatCtx, 0, OutputFileName, 1);

    struct AVCodec *pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
    if (!pCodec)
    {
        retval = 3;
        perror("ff_yuv422_to_jpeg(): avcodec_find_encoder");
        goto out_close_st;
    }

    if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0)
    {
        retval = 4;
        perror("ff_yuv422_to_jpeg(): avcodec_open2");
        goto out_close_st;
    }

    /* ===== frame ===== */
    struct AVFrame* pictureFrame = av_frame_alloc();
    pictureFrame->width = pCodecCtx->width;
    pictureFrame->height = pCodecCtx->height;
    pictureFrame->format = AV_PIX_FMT_YUVJ422P;

    int picSize = av_image_get_buffer_size(AV_PIX_FMT_YUVJ422P, pCodecCtx->width, pCodecCtx->height, 1);
    uint8_t* pictureBuffer = (uint8_t*)av_malloc(picSize);
    av_image_fill_arrays(pictureFrame->data, pictureFrame->linesize, pictureBuffer, AV_PIX_FMT_YUVJ422P, pCodecCtx->width, pCodecCtx->height, 1);

    /* ===== write header ===== */
    int notUseRetVal = avformat_write_header(pFormatCtx, NULL);
    
    struct AVPacket* pkt = av_packet_alloc();
    av_new_packet(pkt, imgHeight * imgWidth * 3);
    pictureFrame->data[0] = pictureBuffer + 0 * (yuvLength / 4);
    pictureFrame->data[1] = pictureBuffer + 2 * (yuvLength / 4);
    pictureFrame->data[2] = pictureBuffer + 3 * (yuvLength / 4);

    /* ===== encode ===== */
    int ret = avcodec_send_frame(pCodecCtx, pictureFrame);
    while (ret >= 0)
    {
        pkt->stream_index = video_st->index;
        ret = avcodec_receive_packet(pCodecCtx, pkt);
        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
        {
            retval = 5;
            perror("ff_yuv422_to_jpeg(): avcodec_receive_packet");
            goto out_close_picture;
        }
        else if (ret < 0)
        {
            retval = 6;
            perror("ff_yuv422_to_jpeg(): avcodec_receive_packet ret < 0");
            goto out_close_picture;
        }
        av_write_frame(pFormatCtx, pkt);
    }
    av_packet_unref(pkt);

    /* ===== write trailer ===== */
    av_write_trailer(pFormatCtx);

#if Print_Debug_Info
    printf("yuv2jpg Encode Success.\n");
#endif

out_close_picture:
    if (pictureFrame) av_free(pictureFrame);
    if (pictureBuffer) av_free(pictureBuffer);

out_close_st:
    // old school
    // if (video_st) avcodec_close(video_st->codec);

out_close_ctx:
    if (pFormatCtx) avformat_free_context(pFormatCtx);

out_return:
    return retval;
}


    


    and my log :

    


    Output #0, image2, to 'img.jpg':
    Stream #0:0: Unknown: none
[image2 @ 0x38750] Encoder did not produce proper pts, making some up.
ff_yuv422_to_jpeg(): avcodec_receive_packet: Success


    


    I looked up the avcodec_receive_packet()'s reference, and my code return error code AVERROR(EAGAIN).

    


  • Using ffmpeg to interpolate images without making video

    28 août 2020, par interwebjill

    The following ffmpeg command works well to interpolate my set of images :

    


    ffmpeg -r <fps> -i <input /> -filter:v minterpolate=fps=:scd=none:mi_mode=blend -pix_fmt yuvj420p <output>&#xA;</output></fps>

    &#xA;

    however, instead of outputting a video, I would like to instead output a directory of image files which include the original images plus the interpolated images. Is this possible with ffmpeg and if so, what are the commands ?

    &#xA;

    I could not find a solution in the ffmpeg documentation or on the wiki.

    &#xA;

  • Powershell : Start-Job a script, cannot connect to youtube

    16 mai 2016, par Kostas Georgokitsos

    I am a bit new to PS, so please bear with me. I have written a script that starts an ffmpeg proccess, and in an endless loop waits for the process, and restarts it as ffmpeg is a bit shaky. ffmpeg is taking an rtsp stream from a camera and forwards it to youtube.

    # initialization
    $buffer_size = "30720k" # 60 sec * 512kbps
    $ffm = "C:\Users\kostas\Downloads\_software\ffmpeg-20160308-git-5061579-win32-static\bin\ffmpeg.exe"
    $params = "-f lavfi -i aevalsrc=0  -thread_queue_size 512 -i rtsp://$($usr):$($pw)@$($cam_ip):554/mpeg-4/ch1/main//av_stream/ -f flv -vcodec copy -acodec aac -bufsize $($buffer_size) rtmp://a.rtmp.youtube.com/live2/$($youtube_key)"
    $params_bak = $params.Replace('/live2/','/live2/?backup=1/')
    # start stream(s)
    while (1 -eq 1) {
     $err_log = "C:\Users\kostas\Documents\logs\Stream_Error-$(Get-Date -Format dd-MM-yyyy_HH-mm-ss).log"
     $out_log = "C:\Users\kostas\Documents\logs\Stream-$(Get-Date -Format dd-MM-yyyy_HH-mm-ss).log"
     $strm_app = Start-Process $ffm $params -PassThru -WindowStyle Minimized -RedirectStandardError $err_log -RedirectStandardOutput $out_log
     Wait-Process $strm_app.Id
    }

    When I call the script from the powershell prompt directly like .\youtube_cam_1.ps1 all is well, but the powershell prompt locks, obviously.

    When I start like Start-Job -FilePath C:\Users\kostas\Documents\youtube_cam_1.ps1 the job starts allright and I also see the ffmpeg process starting and running, but the youtube channel stays offline. Now to the funny bit : doing Stop-Job does not kill the ffmpeg process, and suddenly ffmpeg can connect to youtube.

    I want to start and run several camera streams (i.e. ffmpeg instances) in the end and need the looping script to somehow go into the background. Is Start-Job the wrong way to do it ?

    What is happening ?