Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to use x264 for encoding with ffmpeg ?

    21 mai 2014, par mmmaaak

    I tryed to use ffmpeg for encoding video/ But it fails on initialization of AVCodecContext annd AVCodec. What I do:

    _codec = avcodec_find_encoder(CODEC_ID_H264);
    _codecContext = avcodec_alloc_context3(_codec);
    _codecContext->coder_type = 0;
    _codecContext->me_cmp|= 1;
    _codecContext->me_method=ME_HEX;
    _codecContext->me_subpel_quality = 0;
    _codecContext->me_range = 16;
    _codecContext->gop_size = 12;
    _codecContext->scenechange_threshold = 40;
    _codecContext->i_quant_factor = 0.71;
    _codecContext->b_frame_strategy = 1;
    _codecContext->qcompress = 0.5;
    _codecContext->qmin = 2;
    _codecContext->qmax = 31;
    _codecContext->max_qdiff = 4;
    _codecContext->max_b_frames = 3;
    _codecContext->refs = 3;
    _codecContext->trellis = 1;
    _codecContext->width = format.biWidth;
    _codecContext->height = format.biHeight;
    _codecContext->time_base.num = 1;
    _codecContext->time_base.den = 30;
    _codecContext->pix_fmt = PIX_FMT_YUV420P; 
    _codecContext->chromaoffset = 0;
    _codecContext->thread_count =1;
    _codecContext->bit_rate = (int)(128000.f * 0.80f);
    _codecContext->bit_rate_tolerance = (int) (128000.f * 0.20f);
    int error = avcodec_open2(_codecContext, _codec, NULL);
    if(error<   )
    {
        std::cout<<"Open codec fail. Error "<code>

    In such way ii fails on avopen_codec2() with:

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xae1fdb70 (LWP 30675)]
    0xb2eb2cbb in x264_param_default () from /usr/lib/libx264.so.120
    

    If i comment all AVCodecContext parameters settins - I have :

    [libx264 @ 0xac75edd0] invalid width x height (0x0)
    

    And avcodec_open retunrs negative value. Which steps, I'm doing, are wrong?

    Thanks for any help (ffmpeg 0.10 && libx264 daily snapshot for yesterday)

  • ffmpeg Proper Command to Upscale Video

    19 mai 2014, par user3651716

    We have a problem with the watermark upon ffmpeg conversion to .mp4.

    We use a PHP KVS tube script, running CentOS & hopefully the latest ffmpeg version.

    If input video is in smaller resolution then watermark appearing in the output is too big, so video won't properly re-size (upscale).

    Looking for a proper command that will upscale video resolution if this is smaller than 720px (width). Re sizing bigger videos work fine, but not smaller.

    So, we would always like 720px-1(dynamic height), no matter what is the input video resolution.

    Here is one of the command we have tried to use but it didnt work can you please provide the correct command to upscale videos 720px (width).


    This is the below command which we used but it has not worked _______________________________________________________-

    -vf "resize=720:trunc(ow/a/2)*2" -vcodec libx264 -threads 0 -acodec libfaac -ar 44100 -ab 128k -f mp4

  • x264 encoder with JNA

    17 mai 2014, par baba

    I have been busy creating a JNA wrapper around x264.dll. I have the following class for my x264_param_t:

    http://pastebin.com/Mh4JkVpP

    However, when I try to initialize my x264_param_t like that

    x264_param_t param_t = new x264_param_t;
    

    I get the following error:

    Exception in thread "main" java.lang.IllegalArgumentException: Can't determine size of nested structure: Can't instantiate class anotherReversed.x264_param_t$Vui (java.lang.InstantiationException: anotherReversed.x264_param_t$Vui)
            at com.sun.jna.Structure.calculateSize(Structure.java:790)
            at com.sun.jna.Structure.allocateMemory(Structure.java:287)
            at com.sun.jna.Structure.(Structure.java:177)
            at com.sun.jna.Structure.(Structure.java:167)
            at com.sun.jna.Structure.(Structure.java:163)
            at com.sun.jna.Structure.(Structure.java:154)
            at anotherReversed.x264_param_t.(x264_param_t.java:7)
    

    If I comment out the Vui in it's parent class constructor, the instantiation is ok. I wonder what is different with EXACTLY this nested structure, as there are 2 others (namely Rc and Analyse ) that are nested in the same way. Somehow, though, JNA isn't able to find the required size for Vui. Any pointers?

    Edit: It seems that all the other nested structs (analyse and rc ) were also not initialized. I wonder why?

  • Can't get thumbnails preview in output video files (Rendering x264 .avi with Movie Studio 13.0) [closed]

    12 mai 2014, par SavageStyle

    no thumbnails for output files, using Movie Studio 13.0 and x264->.avi, cannot fugure it out. All other programs, such as simple one: Any Video Converter, work fine with x264 codec and avi container (thumbnails are displayed correctly), but i need Movie Studio to work

  • Create an mp4 container for h264 in c or c++

    9 mai 2014, par Zhenya

    I've successfully been able to encode h264 streams by using the videolan x264 codec in Android NDK. Now I'm searching for a muxer that can create the mp4 container to hold the resulting stream and make it playable. Is there any small portable C or C++ library that can be used in Android NDK to perform such a task?

    Thanks