Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Do the x264 encoder and image colorspace types need to be the same ?

    18 décembre 2017, par quadrupleslap

    Do the i_csp fields in x264_image_t and x264_param_t have to be the same? What happens if they aren't the same?

  • Measure "delta time" between two simulation conditions

    14 décembre 2017, par mrj

    i understand that to measure BD-BR and BD-PSNR 4 data points are required (4 differents QPs). i want to measure time difference between two simulation conditions and each QP provide me a time.

    should i calculate the time difference between each one of the four QPs and then the average of them all**? thanks in advance.

    ** as in:

    deltaTimeQP22 = timeSimulation1QP22 - timeSimulation2QP22
    deltaTimeQP27 = timeSimulation1QP27 - timeSimulation2QP27
    deltaTimeQP32 = timeSimulation1QP32 - timeSimulation2QP32
    deltaTimeQP37 = timeSimulation1QP37 - timeSimulation2QP37
    deltaTime = (deltaTimeQP22 + deltaTimeQP27 + deltaTimeQP32 + deltaTimeQP37)/4
    
  • erroneous pipeline : no element "x264enc"

    27 novembre 2017, par Cerato

    I have a gstreamer command that requires x264enc and the error I get is:

    WARNING: erroneous pipeline: no element "x264enc"

    I saw posts that the solution is to install gstreamer1.0-plugins-ugly, but I need to launch the command in Windows while I was managed to find the plugin only for Linux.

    Please help.

  • Crash in ffmpeg avcodec_free_context in one application but not in other

    5 novembre 2017, par geekowl

    I am building an application in C++ on Windows 10 using Microsoft Visual Studio 2012 Professional.

    I have created a wrapper library around ffmpeg (libavcodec) to encode video in H.264 format using libx264. This wrapper contains following functions:

    Initialize()
    Open()
    EncodeFrame()
    Close()
    Uninitialize()
    

    I created a test application to test the wrapper library. The test application works perfectly fine.

    When I use the wrapper library in my actual main application, the main application crashes in Close() API. Inside close, it crashes in avcodec_free_context(). The difference between the main application and the test application is that the main application links with some more dependent libraries that test application does not link with.

    To debug the problem in the main application, I put avcodec_free_context() in Open() after the context is allocated. The crash occurs if avcodec_free_context() is put at a certain point as shown below.

    pCodecContext = avcodec_alloc_context3(pCodec);
    
    // <---- No crash here.
    
    pCodecContext->bit_rate = 200000;
    pCodecContext->width = 320;
    pCodecContext->height = 240;
    .
    .
    .
    if (pCodec->id == AV_CODEC_ID_H264)
    {
        av_opt_set(pCodecContext->priv_data, "preset", "slow", 0);
        av_opt_set(pCodecContext->priv_data, "tune", "zerolatency", 0);
    }
    
    pCodecContext->flags |= CODEC_FLAG_GLOBAL_HEADER;
    
    // <-- No crash here
    
    if (avcodec_open2(pCodecContext, pCodec, NULL) < 0)
    {
        return -1;
    }
    
    // <-- Crash here [avcodec_free_context(&pCodecContext);]
    

    What is a correct approach to identify and resolve this problem?

    Thanks in advance.

    Update

    I found out that ffmpeg was built using gcc. That was causing the crash. I rebuilt ffmpeg using Visual Studio. That solved problem.

  • Why use sysconf(_SC_NPROCESSORS_CONF) to get the number of CPU cores in x264 ?

    5 novembre 2017, par bknieven

    I find x264 use sysconf(_SC_NPROCESSORS_CONF) instead of sysconf(SC_NPROCESSORS_ONLN) to get the number of CPU cores.

    Here is the code snippet in x264/common/cpu.c:

    ...
    #ifdef __ANDROID__
        // Android NDK does not expose sched_getaffinity
        return sysconf( _SC_NPROCESSORS_CONF );
    #else
        ...
    ....
    

    And I find the difference between _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN in this manual:

    sysconf (_SC_NPROCESSORS_CONF) which returns the number of processors the operating system configured. But it might be possible for the operating system to disable individual processors and so the call sysconf (_SC_NPROCESSORS_ONLN) returns the number of processors which are currently online (i.e., available).

    I have two questions:

    1. What is the difference between "the number of processors the operating system configured" and "the number of processors which are currently online"?
    2. Why x264 use _SC_NPROCESSORS_CONF in Android to get the number of CPU cores?