Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Creating a pipe between C# and Ffmpeg

    15 décembre 2011, par John Oliver

    I have a C# program that creates a video and saves it to the disk in real-time. Instead of doing that, I want it to write it directly in a pipe connected with ffmpeg...

    The function that keeps saving the video in the disk, which I can not control, receives an IntPtr with a reference to the file.

    So, I need to create a pipe or something like that with ffmpeg, get a pointer to that, and use that pointer in the function, so that it streams the file to ffmpeg and not the disk...

    Regards, John Oliver

  • How to encode video using ffmpeg-java on Android from Bitmaps ?

    15 décembre 2011, par gtcompscientist

    I am using ffmpeg-java compiled for Android to encode/decode video for my application.

    The problem that I've run into is that I am currently getting each frame as a Bitmap (just a plain android.graphics.Bitmap) and I can't figure out how to stuff that into the encoder.

    Here is the code that I am using to instantiate all the ffmpeg libraries:

        AVCodecLibrary cLibrary = AVCodecLibrary.INSTANCE;
        cLibrary.avcodec_register_all();
        cLibrary.avcodec_init();
    
        AVFormatLibrary fLibrary = AVFormatLibrary.INSTANCE;
        fLibrary.av_register_all();
    
        //AVUtilLibrary uLibrary = AVUtilLibrary.INSTANCE;
        //uLibrary.av_malloc();
    
        AVCodec pCodec = cLibrary.avcodec_find_encoder(AVCodecLibrary.CODEC_ID_H263);
        if (pCodec == null)
        {
            Logging.Log("Unable to find codec.");
            return;
        }
        Logging.Log("Found codec.");
    
    
        AVCodecContext codecCtx = cLibrary.avcodec_alloc_context();
        codecCtx.bit_rate = 64000;
        codecCtx.coded_width = VIDEO_WIDTH;
        codecCtx.coded_height = VIDEO_HEIGHT;
        codecCtx.time_base = new AVRational(1, VIDEO_FPS);
        codecCtx.pix_fmt = AVCodecLibrary.PIX_FMT_YUV420P;
        codecCtx.codec_id = AVCodecLibrary.CODEC_ID_H263;
        //codecCtx.codec_type = AVMEDIA_TYPE_VIDEO;
    
        if (cLibrary.avcodec_open(codecCtx, pCodec) < 0)
        {
            Logging.Log("Unable to open codec.");
            return;
        }
        Logging.Log("Codec opened.");
    

    This is what I want to be able to execute next:

    cLibrary.avcodec_encode_video(codecCtx, pPointer, pFrame.size(), pFrame);
    

    But, as of now, I don't know how to put the Bitmap into the right piece or if I have that setup correctly.

    A few notes about the code: - VIDEO_WIDTH = 352 - VIDEO_HEIGHT = 288 - VIDEO_FPS = 30; - I'm unsure about how pPointer and pFrame are handled.

  • Anybody has any idea how this site works ? www.ivipid.com [closed]

    14 décembre 2011, par Aamir Siddique

    I am a website developer (php) and i have been given a task to develop a similar website:

    http://ivipid.com/

    I need to make an identical website and i am trying to figure out how this can be done.

    Any ideas would be highly appreciated, please advice.

    Thanks!

  • FFMPEG : is there a way to keep RTSP connection alive in code ?

    14 décembre 2011, par Alex

    I'm taking frames from a RTSP connection as follows (in pseudocode):

    av_open_input_file(&avcontext)
    while(av_read_frame(&frame) > 0) {
        doSomething(frame);
        av_free_packet(frame);
    }
    

    For some reason the doSomething() function takes much time and, because of this (at least, I think so) the connection interupts - av_read_frame() returns 'eof' and the loop exits.

    When I make doSomething() shorter such interruptions do not occur.

    For some reasons I can't do doSomething() in another thread.

    Therefore, I'm interested if maybe there are some parameters to avcontext which will let me keep the connection alive or increase the timeout?

    Thank you!

  • Installing faad library for ffmpeg through Homebrew on mac OS X Lion

    14 décembre 2011, par alex

    Following up with my previous question, I decided to give Ffmpeg a try and installed it on my Mac with Homebrew.

    I am now trying to follow this tutorial and use the linked script. But can't make/install the script. I first corrected a small bug (replaced CODEC_TYPE_AUDIO, CODEC_TYPE_VIDEO and PKT_FLAG_KEY with AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_VIDEO, and AV_PKT_FLAG_KEY respectively in live_segmenter.c). But now, when I run make in the unzipped folder, I get the following warning and error messages:

    gcc -Wall -g live_segmenter.c -o live_segmenter -lavformat -lavcodec -lavutil -lbz2 -lm -lz -lfaac -lmp3lame -lx264 -lfaad -lpthread
    live_segmenter.c: In function ‘main’:
    live_segmenter.c:149: warning: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1093)
    live_segmenter.c:165: warning: implicit declaration of function ‘guess_format’
    live_segmenter.c:165: warning: initialization makes pointer from integer without a cast
    live_segmenter.c:208: warning: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1407)
    live_segmenter.c:214: warning: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1535)
    live_segmenter.c:232: warning: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
    live_segmenter.c:238: warning: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1465)
    live_segmenter.c:283: warning: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293)
    live_segmenter.c:284: warning: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
    live_segmenter.c:289: warning: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279)
    live_segmenter.c:326: warning: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280)
    ld: library not found for -lfaad
    collect2: ld returned 1 exit status
    make: *** [all] Error 1
    

    I also downloaded the faac/faad libraries from here. When I run make in faac, it says I have nothing to install, but I can't find out how to install faad...

    Would love any help you can offer!