Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Android Canvas Screen activity Recording

    25 mai 2014, par nihartrivedi810

    I'm making a canvas application which can write,draw and edit. Now I'm adding feature of recording the screen activity and saving as video. What can I do record screen activity and save as video? Actually I have tried Using NDK, Jcodec ,ffmpeg,etc. This thing are bit tough to me and I'm finding difficulty. Can anyone suggest any easy or proper way to this things? Please suggest as soon as possible. Thank you!

  • av_video_decode2 RETURNS THE VALUE -1094995529 in the threaded function

    24 mai 2014, par Whoami

    I am developing rtsp streaming player, and followed the below approach.

    1) Read packet, decode, display -> works perfectly.

    while (1) {
        if ( av_read_frame(pFormatCtx, &packet) >= 0) {
            if (packet.stream_index == videoStream) {
                retDecoder = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
                if  ( retDecoder <= 0)
                    LOGD (" Unable to Decode...retval %d ", retDecoder);
                if (frameFinished) {
                }
            }
            av_free_packet (&packet);
        }
    }
    

    Whereas,

    I introduced two threads, one is reading and pushing into the queue and the second one is reading from the queue.

    My problem is while reading the same packet, and decode, i m unable to decode, the return value of the av_video_decode2 is -1094995529.

    Below is the short description of code. Kindly help to solve this issue?.

    AVPacketList *firstNode=NULL, *lastNode=NULL;
    
    int pushPacket (AVPacket * pkt)
    {
        AVPacketList *newNode = av_malloc(sizeof(AVPacketList));
        newNode->pkt = *pkt;
        newNode->next = NULL;
    
        SDL_LockMutex (rwMutex);
    
        if (lastNode != NULL )  {
            lastNode->next = newNode;
            lastNode = newNode;
        } else {
            firstNode = lastNode = newNode;
        }
    
     SDL_UnlockMutex (rwMutex);
    }
    
    int pullPacket ()
    {
        AVPacketList *tempNode;
        AVPacket *pkt;
        int res=0;
    
        SDL_LockMutex (rwMutex);
        if ( firstNode != NULL ) {
            tempNode = firstNode;
            *pkt = tempNode->pkt;
            res = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, pkt);  // HERE IS THE PROBLEM.
            if (frameFinished) {
                LOGD (" fRAME DECODED.. %d \n", counter++);
            }
    
            if (firstNode->next != NULL) {   
                firstNode = firstNode->next;
            }
            else {
                firstNode = NULL;
                lastNode = NULL;
            }
            av_free (tempNode);
        }
    }
    

    In Thread 1:

    int PacketReader (void *ptr)
    {
        AVPacket pkt1, *rpacket;
        rpacket = &pkt1;
        while (globalQuit != 0)  {
            if ( av_read_frame(pFormatCtx, rpacket) >= 0) {
                if (packet.stream_index == videoStream) {
                    pushPacket (rpacket);
                }
                av_free_packet(rpacket);
            }
        }
    }
    

    In thread 2:

    while (1) {
       pullPacket ();
    }
    
  • Is it possible to compile ffmpeg in visual studio 2010 ?

    24 mai 2014, par Exitos

    Is it possible to compile the sourcecode from ffmpeg in visual studio 2010? Is it difficult?

    Just looking for some advice (and instructions) if possible. :-)

    Cheers,

    Pete

  • How to generate the images sequence for video

    24 mai 2014, par Albert Li

    I want to make a simple video editor to create the video from some images. It have some transform effects such as motion, scale, fade etc...

    I tried to create the images per frame using ImageMagick and create the video using ffmpeg.

    But it doens't move smoothly, seems to be kind of jaggy when it moves.

    For example, for 10s x 30fps video, it needs 300 images. Source image should to move 300px.

    The image in the result video moved 1px by 1px.

    How to generate the images sequence for smooth motion effect to make a video?

  • node.js live streaming ffmpeg stdout to res

    24 mai 2014, par blasteye

    I want node.js to convert an extremly long audio file to mp3, and the second data is available on stdout, node.js should send it to the client for them to play.

    I've written the following, and while it works, the html5 audio/video tag waits until ffmpeg is 100% done transcoding, where-as I want to start playing the video while ffmpeg is doing its thing.

    var ffmpeg = childProcess.spawn('ffmpeg', [
       '-i', params.location, //location of the specified media file
       '-f', 'mp3',
       'pipe:1'
     ]);
     res.writeHead(200, {
       'Content-Type': 'audio/mp3'
     });
     ffmpeg.stdout.pipe(res);
    

    EDIT 1: Not sure why, but if params.location points to a movie everything seems to work. But if its an audio file, ffmpeg doesn't seem to be outputting to stdout until its 100% converted.

    EDIT 2: Turns out that you can't dump an mp4 file to stdout due to the fact that mp4 files are non Causal (http://en.wikipedia.org/wiki/Causal_system). THerefore if you use webm it works. Just make sure to compile ffmpeg with webm support (for homebrew users: brew install ffmpeg --with-vpx --with-vorbis ).

    I've uploaded a github gist showing two functions to send live mp3/webm transcodes: https://gist.github.com/cobookman/c1a9856a4588496b021a