Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • avformat_open_input() error -1330794744 : Could not open input

    22 mai 2014, par Navid

    When I run my code on unix (postproc removed):

    FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber("https://.../ec769038-22d9-4da9-a7bf-dd4647f97964-353.mp4?__h__=1400667080_dfb4fabf293d258cd501ab4978419392");
    IplImage capturedImage = null;
    
    try {
        frameGrabber.start();
        long lengthInTime = frameGrabber.getLengthInTime();
        long i = 0;
        while(i < lengthInTime) {
            frameGrabber.setTimestamp(i);
            capturedImage = frameGrabber.grab();
            // if capturedImage is null ... error
            if(capturedImage == null)
                break;
            LOG.info("frame: " + i + "  " + capturedImage.depth());
            i += 10 * 1000 * 1000; // microseconds
        }
        frameGrabber.stop();
        frameGrabber.release();
    } catch (Exception e) {
        LOG.error(e.getMessage());
    }
    

    I get this error:

    avformat_open_input() error -1330794744: Could not open input "https://.../ec769038-22d9-4da9-a7bf-dd4647f97964-353.mp4?__h__=1400667080_dfb4fabf293d258cd501ab4978419392". (Has setFormat() been called?)
    

    I am running the program in Red Hat Same code works with local file path. I know URL works because the same code (but postproc not excluded) works in Windows. I am using Javacv 0.5 both in Red Hat and Windows (that's the only choice I have at work)

  • av_frame_alloc is returning null

    22 mai 2014, par user1789711

    I am just starting to use the ffmpeg library using C++, while trying to decode my video file I am facing an error in one of the steps when trying to allocate an avFrame by using the function av_frame_alloc which is supposed to return an avFrame, however it is returning NULL which indicates that the allocation has failed. I have tried to search on web but couldn't find any relevant information, and here is my code so far:

    extern "C"
    {
    # pragma comment (lib, "avformat.lib")
    #define __STDC_CONSTANT_MACROS
    #include "libavcodec\avcodec.h"
    #include "libavutil\frame.h"
    #include "libavformat\avformat.h"
    
    }
    #include 
    using namespace std;
    
    int main(int argc, char* argv[])
    {
        char * filename="D:\\MOV_0051.mp4";
        av_register_all();
        AVFormatContext *pFormatCtx=NULL;
        if(avformat_open_input(&pFormatCtx,filename,0,0) !=0)
        {
            cout<<"failed to open file";
            return -1;
    
        }
        AVCodecContext *pCodecCtx=NULL;
        int i=av_find_default_stream_index(pFormatCtx);
        pCodecCtx=pFormatCtx->streams[i]->codec;
        AVCodec *pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
        if(pCodec==NULL)
            cout<<"codec not supported";
        if(avcodec_open2(pCodecCtx,pCodec,NULL)<0)
        {
            return -1;
            cout<<"codec not opened";
        }
        if(avcodec_is_open(pCodecCtx)<0)
            return -1;
    
        AVFrame *pFrame;
        pFrame=av_frame_alloc();
        //this is were the problem in happening everything else is working just fine
        if(av_frame_alloc()==NULL)
          cout<<"worked";
        else
            cout<<"not wroking";
    
        cin>>i;
    
        return 0;
    } 
    
  • How to put watermak on video with FFMPEG,without resizing the watermark because of video resolution ?

    22 mai 2014, par Shahbaz Younis

    I'm looking for a way that the watermark picture does not get resized,if the video resolution is high or less. Right now I have this problem, if I upload a video like 720p the watermark is really small and when I upload a video that is 240p the watermark is really big. I would just like it to be only one size. Can it do that automatically? So no matter what the resolution is the of the video the image does not resizes and stays where I put it? Here's the code I'm using right now

    if ($ffmpeg_ver == "old") {
                        $watermark = '-vf "movie='.$tv_logo_path.' [watermark]; [in][watermark] overlay=10:10 [out]" ';
                } else { 
                        $watermark = '-i '.$tv_logo_path.' -filter_complex "overlay=10:10" ';
                }
    
  • Extra data within image (PPM/PAM/PNM)

    22 mai 2014, par Sean D

    Is it possible to store extra data in pixels of a binary PNM file in such a way that it can still be read as an image (hopefully by any decoder, but specifically by ffmpeg)?

    I have a simulation that saves its data as PPM currently and I'd like a way to record more than three values per pixel in the file, and yet still be able to use it as an image (obviously only the first three/four values will actually affect the image).

    In particle I think the TUPLTYPE of PAM should allow me to do this, but I don't know how make something that's also a readable image from that.

  • Avisynth processing source having multiaudio tracks

    22 mai 2014, par Tarun

    I wrote following avisynth script

    A1 = FFAudioSource("speed_2mins.mxf",track=1)
    A2 = FFAudioSource("speed_2mins.mxf",track=2)
    V = FFVideoSource("speed_2mins.mxf",width=200,height=100)
    AV1 = AudioDub(V,A1)
    AudioDub(AV1,A2)
    

    In hope of getting 2 audio tracks in the output, but i still got only one audio track when I processed the .avs file using ffmpeg

    How to get multi audio tracks output using avisynth?