Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Error "Transparency encoding with auto_alt_ref does not work" when converting a .mov with Alpha to .webm with alpha with ffmpeg [closed]

    13 février, par ThomTTP

    I am trying to convert a .mov file with alpha transparency into a .webm file and have been following this thread for help: Convert mov with Alpha to VP9 Webm with Alpha Using ffmpeg

    The command line I have been using is

    ffmpeg -r 24/1 -i Desktop/Skel_Walk_1.mov -c:v libvpx -pix_fmt yuva420p Desktop/Skel_Walk_1.webm
    

    However when I go to run the command it comes up with 2 errors

    Transparency encoding with auto_alt_ref does not work
    

    and

    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 
    - maybe incorrect parameters such as bit_rate, rate, width or height
    

    I am not too sure what the problem is here, any suggestions, I am very confused!

  • How to reinitialize AVCodec with updated AVCodecContext on fly

    13 février, par Alemao

    There is a question about an old (0.7) version of the FFMPEG(LibAV) library, including to my project as

    extern "C" {
        #include avcodec.h>
        #include avformat.h>
        #include avfilter.h>
        #include timestamp.h>
        #include pixdesc.h>
        #include opt.h>
    }
    

    I have an AVCodec object, which knows how to encode my frames(to H264 codec). I have an object of AVCodecContext type, initialized with the parameters that I need (bitrate, framerate etc.).

        AVCodec *encoderVideoCodec = nullptr;
        AVCodecContext *encoderVideoCodecContext = nullptr;
    

    Then I initialize AVCodec with its context, setting some important parameters from decoder (Before that I analyzed input RTSP stream from camera).

        encoderVideoCodecContext = avcodec_alloc_context3(encoderVideoCodec);
        if(!encoderVideoCodecContext) {
            std::cerr << "Error" << std::endl;
            return 1;
        }
    
        av_opt_set(encoderVideoCodecContext->priv_data, "preset", "fast", 0);
        if(outStreamParams.codec_priv_key && outStreamParams.codec_priv_value)
            av_opt_set(encoderVideoCodecContext->priv_data, outStreamParams.codec_priv_key, outStreamParams.codec_priv_value, 0);
    
        encoderVideoCodecContext->height = decoderVideoCodecContext->height;
        encoderVideoCodecContext->width = decoderVideoCodecContext->width;
        encoderVideoCodecContext->sample_aspect_ratio = decoderVideoCodecContext->sample_aspect_ratio;
    
        if(encoderVideoCodec->pix_fmts)
            encoderVideoCodecContext->pix_fmt = encoderVideoCodec->pix_fmts[0];
        else
            encoderVideoCodecContext->pix_fmt = decoderVideoCodecContext->pix_fmt;
    
        encoderVideoCodecContext->bit_rate = bitrate;
        encoderVideoCodecContext->rc_buffer_size = 4*1000*1000;
        encoderVideoCodecContext->rc_max_rate = 2*1000*1000;
        encoderVideoCodecContext->rc_min_rate = 2.5*1000*1000;
        encoderVideoCodecContext->time_base = av_inv_q(frameRate);
        encoderVideoStream->time_base = encoderVideoCodecContext->time_base;
    
        int ret = 0;
        ret = avcodec_open2(encoderVideoCodecContext, encoderVideoCodec, nullptr);
        if(ret < 0 ) {
            std::cerr << "Error" << std::endl;
            return 1;
        }
    
        ret = avcodec_parameters_from_context(encoderVideoStream->codecpar, encoderVideoCodecContext);
        if(ret < 0) {
            std::cerr << "Ошибка копирования параметров из контекста энкодера в энкодер " << std::endl;
            return 1;
        } else {
            std::cout << "Параметры энкодера заполнены из контекста" << std::endl;
        }
    

    Then I start the process of encoding, and everything goes well. But, for example, in the middle of this process I want to change the bitrate on the fly. I change AVCodecContext::bit_rate and then call the init() method of AVCodec to apply changes.

        encoderVideoCodecContext->bit_rate = bitrate;
        int res = -1;
        res = encoderVideoCodec->init(encoderVideoCodecContext);
    

    And the bitrate value changed. But Valgrind tells me that for this operation I have a memory leak of about 100 bytes. init() method allocates some memory that doesn't clean then. Can you, please,help me and advise the right way to do this operation. Or what memory should I clean and the allocate again to fix memory leak?

  • Converting audio/video tracks to AAC format in C# app

    13 février, par Alex1347

    I try convert audio/video tracks to AAC format using qaac lib. In CMD it works and output information about progress of convertation. In my C# app it works too, but I can't get information about progress, i try use these events: OutputDataReceived, ErrorDataReceived. In handler of ErrorDataReceived I don't get needed information, in handler of OutputDataReceived I get received.Data like null value. How can I get conversion progress information during conversion in C# code?

    (I use qaac lib because ffmpeg lib convert tracks to AAC incorrect - incorrect duration of result track, resolving not find for this problem, some analog apps have the same bug.)

    Creating process for converting:

    string arguments = $"\"{engineParameters.InputFile.Filename}\" -no-delay -o \"{engineParameters.OutputFile.Filename}\"";
    
    processStartInfo = new ProcessStartInfo
    {
        FileName = QaacFilePath,
        Arguments = arguments,
        RedirectStandardOutput = true,
        UseShellExecute = false,
        CreateNoWindow = true,
        WindowStyle = ProcessWindowStyle.Hidden
    };
    

    Also I call these methods for process:

    BeginOutputReadLine();
    BeginErrorReadLine();
    WaitForExit();
    

    Handlers:

    this.Process.OutputDataReceived += (sender, received) =>
    {
        if (received.Data == null) return;
        //Some code...
    }
    
    this.Process.ErrorDataReceived += (sender, received) =>
    {
        if (received.Data == null) return;
        //Some code...
    }
    
  • How to disable slf4j log in java

    12 février, par Model123123

    Sorry for my poor English.

    I'm using ffmpeg-cli-wrapper library in java

    [main] INFO net.bramp.ffmpeg.RunProcessFunction - .\ffprobe.exe -version

    [main] INFO net.bramp.ffmpeg.RunProcessFunction - .\ffprobe.exe -v quiet -print_format json -show_error -show_format -show_streams -show_chapters

    How to remove this log?

    try this:

    1. java.util.logging.Logger.getLogger("net.bramp.ffmpeg").setLevel(Level.OFF);

    2. /logger name="net.bramp.ffmpeg" level="OFF"/ in logback.xml

    but not work...

    RunProcessFunction src: https://github.com/bramp/ffmpeg-cli-wrapper/blob/master/src/main/java/net/bramp/ffmpeg/RunProcessFunction.java

  • Use FFmpeg in Visual Studio

    12 février, par box

    I'm trying to use FFmpeg in a C++ project in Visual Studio 2010. I want to include the libraries as statically linked files. Simple programs like libavcodec/api-example.c compile without error and no linker error appears in the error view when starting them. However, a message box shows up after starting the application, saying that avutil-51.dll is missing. Do you have any hints on how to fix that?

    I used the latest dev build from http://ffmpeg.zeranoe.com/builds/. Then I specified include as additional include directory, avcodec.lib;avfilter.lib;avformat.lib;avutil.lib as additional dependencies and lib as additional library directory.