Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (56)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

Sur d’autres sites (5563)

  • AVCodecContex returns zero for width and height in android

    17 février 2023, par Whoami

    Not sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android.

    



    QUESTION :
Why Width and Height of the CodecContext gives me always zero ?..

    



    int main(int argc, char *argv[])&#xA;{&#xA;&#xA;    int flags;&#xA;    flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;&#xA;&#xA;    if (SDL_Init (flags)) {&#xA;        LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());&#xA;    }&#xA;    else &#xA;        LOGD (" SUCCESS: SDL_Init ");&#xA;&#xA;    // ffmpeg Register all services..&#xA;    ffmpeg_register_all (); &#xA;&#xA;&#xA;    pFrame = avcodec_alloc_frame ();&#xA;    context = avformat_alloc_context();&#xA;&#xA;    err = avformat_open_input (&amp;context, "rtsp:ip:port", NULL, NULL);&#xA;    if ( err &lt; 0) {&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");&#xA;&#xA;        return -1;&#xA;    }&#xA;&#xA;    for (i = 0; i &lt; context->nb_streams; i&#x2B;&#x2B;)&#xA;    {               &#xA;        // Find the Decoder.&#xA;        codec = avcodec_find_decoder(context->streams[i]->codec->codec_id);&#xA;        if (codec->type  == AVMEDIA_TYPE_VIDEO ) {&#xA;            __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming..  ");&#xA;            videoStreamIndex = i;&#xA;&#xA;        }&#xA;    }&#xA;&#xA;    // Play RTSP&#xA;    av_read_play(context);&#xA;&#xA;    // Get Codec Context.&#xA;    pCodecCtx = context->streams[videoStreamIndex]->codec;&#xA;    if ( pCodecCtx == NULL )&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL>>> ");&#xA;    else&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is &lt;&lt;<ok>>> ");&#xA;&#xA;&#xA;    //Find the Decoder.&#xA;    pCodec = avcodec_find_decoder (pCodecCtx->codec_id);&#xA;    avcodec_open2 (pCodecCtx, pCodec, NULL);&#xA;&#xA;&#xA;    int w = pCodecCtx->width;  // Why me getting 0 ? &#xA;    int h = pCodecCtx->height;&#xA;&#xA;    window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);&#xA;    // What this HIGHDPI Means ??&#xA;&#xA;    if ( window != NULL ) &#xA;    {&#xA;        LOGD (" WINDOW CREATED.. , create Renderer ..");&#xA;        renderer = SDL_CreateRenderer (window, -1, 0);  &#xA;    }&#xA;    else&#xA;    {&#xA;        LOGD (" Invalid SDL Window ");  &#xA;    }&#xA;__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h); &#xA;    return 0;&#xA;}&#xA;</ok>

    &#xA;

  • avcodec_open2 returns -22 "Invalid argument" trying to encode AV_CODEC_ID_H264

    26 mai 2023, par Fries of Doom

    I'm trying to use libavcodec to encode h264 video but avcodec_open2 returns -22 "Invalid argument" and I can't figure out why. Here is my code, which is mostly a copy from the encode example from libavcodec.

    &#xA;

        /* find the mpeg1video encoder */&#xA;    const AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_H264);&#xA;    if (!codec) {&#xA;        fprintf(stderr, "Codec &#x27;%s&#x27; not found\n", "h.264");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    AVCodecContext* codecContext = avcodec_alloc_context3(codec);&#xA;    if (!codecContext) {&#xA;        fprintf(stderr, "Could not allocate video codec context\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    AVPacket* pkt = av_packet_alloc();&#xA;    if (!pkt)&#xA;        exit(1);&#xA;&#xA;    /* put sample parameters */&#xA;    codecContext->bit_rate = 400000;&#xA;    /* resolution must be a multiple of two */&#xA;    codecContext->width = 1920;&#xA;    codecContext->height = 1080;&#xA;    /* frames per second */&#xA;    codecContext->time_base = { 1, 25 };&#xA;    codecContext->framerate = { 25, 1 };&#xA;&#xA;    /* emit one intra frame every ten frames&#xA;     * check frame pict_type before passing frame&#xA;     * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I&#xA;     * then gop_size is ignored and the output of encoder&#xA;     * will always be I frame irrespective to gop_size&#xA;     */&#xA;    codecContext->gop_size = 10;&#xA;    codecContext->max_b_frames = 1;&#xA;    codecContext->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    codecContext->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;&#xA;    if (codec->id == AV_CODEC_ID_H264)&#xA;        av_opt_set(codecContext->priv_data, "profile", "baseline", 0);&#xA;&#xA;    /* open it */&#xA;    int ret = avcodec_open2(codecContext, codec, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        char eb[AV_ERROR_MAX_STRING_SIZE];&#xA;        fprintf(stderr, "Could not open codec: %s\n", av_make_error_string(eb, AV_ERROR_MAX_STRING_SIZE, ret));&#xA;        exit(1);&#xA;    }&#xA;

    &#xA;

    Does anyone know what I'm doing wrong ?

    &#xA;

  • av_read_frame() in ffmpeg returns -5 while receiving UDP data [closed]

    26 février 2024, par zttang

    I'm working on an app which is using ffmpeg lib. There is a living source keep sending TS stream thru udp. Then I allocated a thread use ffmpeg receive the TS packets. the code for this thread is like :

    &#xA;

    void* av_source_thread(void *data) {&#xA;    char udp_url[50];&#xA;    snprintf(udp_url, sizeof(udp_url), "udp://127.0.0.1:12345");&#xA;    AVDictionary* options = NULL;&#xA;    av_dict_set(&amp;options, "timeout", "500000", 0);  // timeout=0.5s&#xA;    av_dict_set(&amp;options, "overrun_nonfatal", "1", 0);&#xA;    av_dict_set(&amp;options, "fifo_size", "278876", 0);  //50MB&#xA;&#xA;    AVFormatContext *ffmpeg_source = avformat_alloc_context();&#xA;    while (running) {&#xA;        if (avformat_open_input(&amp;ffmpeg_source, udp_url, NULL, &amp;options) != 0) {&#xA;            continue;&#xA;        } else {&#xA;            break;&#xA;        }&#xA;    }&#xA;    // Some code fill codec type and alloc context here&#xA;&#xA;    av_format_inject_global_side_data(ffmpeg_source);&#xA;    AVPacket *packet = av_packet_alloc();&#xA;    while (running) {&#xA;        ret = av_read_frame(ffmpeg_source, packet);&#xA;        if (ret &lt; 0) {&#xA;            char errbuf[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_strerror(ret, errbuf, AV_ERROR_MAX_STRING_SIZE);&#xA;            usleep(10000);&#xA;            log("av_read_frame failed, Exit, %s, %d", errbuf, ret);&#xA;            continue;&#xA;        }&#xA;        putPkt2Q(packet);  &#xA;    }&#xA;    av_packet_free(&amp;packet);&#xA;    avformat_close_input(&amp;ffmpeg_source);&#xA;    av_dict_free(&amp;options);&#xA;    return nullptr;&#xA;}&#xA;

    &#xA;

    Then the packets will be sent to Q and other thread will process them. but when I run the program, the av_read_frame will return -5(I/O error) from time to time. and once it returned -5, it can not recover unless I restart this thread.

    &#xA;

    since this is a real time source, so lost some frames are acceptable, I just want to know how to avoid this kind of issue or how to recover without restart the whole thread. I tried to increase the fifo_size in options, but it does not work.

    &#xA;