Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG creating MP4 video out of JPGs, but playback is instant

    19 décembre 2014, par lostPixels

    I have a NodeJS server that's taking JPG sequences and turning them into MP4's with libx264. For two of my three videos, everything is fine.

    However on one of my videos, the playback shoots from the beginning to the end in an instant. It's like the FPS is uncapped. The other odd thing about this is that the JPG files didn't seem to have a content-length header when I downloaded them. I'm not sure if that's related or not.

  • ffmpeg conversion x264 [error] : malloc of size 769152 failed

    18 décembre 2014, par prashanthp

    I am trying to convert video recorded from Android smart watch (.mp4 format) to a format (.mp4) which playable on all browsers. The video recorded from smart watch is not playing in the browsers. so, i've used ffmpeg to convert in into a playable mp4 format.

    But sometimes it is showing error as x264 [error]: malloc of size 503008 failed

    What is the reason for this. Sometimes it's getting converted and sometimes it is showing error .

    Here is the console output.

     /usr/local/ffmpeg_build/ffmpeg/bin/ffmpeg  -i /home/xestatt1/public_html/app/webroot/mobile/uploads/in/Dec152014161945.mp4 -vcodec libx264   -r 24 -s 352*288 -acodec aac  -ab 12k -strict -2  /home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4
    
    ffmpeg version 2.5.git Copyright (c) 2000-2014 the FFmpeg developers
      built on Dec 13 2014 05:42:08 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-55)
      configuration: --prefix=/usr/local/ffmpeg_build/ffmpeg --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/ffmpeg_build/x264/include --extra-ldflags=-L/usr/local/ffmpeg_build/x264/lib
      libavutil      54. 15.100 / 54. 15.100
      libavcodec     56. 14.100 / 56. 14.100
      libavformat    56. 15.103 / 56. 15.103
      libavdevice    56.  3.100 / 56.  3.100
      libavfilter     5.  2.103 /  5.  2.103
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/xestatt1/public_html/app/webroot/mobile/uploads/in/Dec152014161945.mp4':
      Metadata:
        major_brand     : 3gp4
        minor_version   : 0
        compatible_brands: isom3gp4
        creation_time   : 2014-12-15 10:50:02
      Duration: 00:00:10.12, start: 0.000000, bitrate: 151 kb/s
        Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 135 kb/s, 13.14 fps, 50 tbr, 90k tbn, 200 tbc (default)
        Metadata:
          creation_time   : 2014-12-15 10:50:02
          handler_name    : VideoHandle
          encoder         :
        Stream #0:1(eng): Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono, flt, 12 kb/s (default)
        Metadata:
          creation_time   : 2014-12-15 10:50:02
          handler_name    : SoundHandle
    File '/home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4' already exists. Overwrite ? [y/N] y
    [libx264 @ 0x13b69120] using SAR=12/11
    [libx264 @ 0x13b69120] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
    [libx264 @ 0x13b69120] profile High, level 1.3
    [libx264 @ 0x13b69120] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '/home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4':
      Metadata:
        major_brand     : 3gp4
        minor_version   : 0
        compatible_brands: isom3gp4
        encoder         : Lavf56.15.103
        Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 352x288 [SAR 12:11 DAR 4:3], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
        Metadata:
          creation_time   : 2014-12-15 10:50:02
          handler_name    : VideoHandle
          encoder         : Lavc56.14.100 libx264
        Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 12 kb/s (default)
        Metadata:
          creation_time   : 2014-12-15 10:50:02
          handler_name    : SoundHandle
          encoder         : Lavc56.14.100 aac
    Stream mapping:
      Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
      Stream #0:1 -> #0:1 (amr_nb (amrnb) -> aac (native))
    Press [q] to stop, [?] for help
    Past duration 1.000000 too large
    Multiple frames in a packet from stream 1
    Past duration 1.000000 too large
    av_interleaved_write_frame(): Cannot allocate memory
    x264 [error]: malloc of size 769152 failed
    Video encoding failed
    [libx264 @ 0x13b69120] frame I:1     Avg QP:22.20  size:  3166
    [libx264 @ 0x13b69120] mb I  I16..4: 28.3% 70.5%  1.3%
    [libx264 @ 0x13b69120] 8x8 transform intra:70.5%
    [libx264 @ 0x13b69120] coded y,uvDC,uvAC intra: 47.5% 55.3% 12.4%
    [libx264 @ 0x13b69120] i16 v,h,dc,p: 16% 26%  6% 52%
    [libx264 @ 0x13b69120] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 19% 15% 12%  3%  3%  3%  5% 16%
    [libx264 @ 0x13b69120] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  2% 20% 10% 16% 14%  4% 11%  6%
    [libx264 @ 0x13b69120] i8c dc,h,v,p: 61% 17% 19%  4%
    [libx264 @ 0x13b69120] kb/s:607.87
    [aac @ 0x13b6a4c0] 2 frames left in the queue on closing
    Conversion failed!
    

    UPDATED

    When i execute this from shell it is working fine. But when i create a script file and trying to execute that script file from php , it is showing error's. I increased the memory limit in php, still it is showing error. Also , we are using ZEND framework. Is there any problems with ZEND??

  • ffmpeg wont encode h264 mp4 video with libx264 installed

    2 décembre 2014, par el producer

    I'm trying to do a simple encoding of an mp4 in h264 to mp4 but I keep getting the error:

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

    I'm using this command:

    ffmpeg -i qDqMvfoapXh6FO3KMuYiZCcG.mp4 out.mp4
    

    I have compiled and installed from the ffmpeginstaller 8.0 from http://ffmpeginstaller.com/

    This was working until i removed everything containing ffmpeg in the file name so that I can install libvpx and recompile ffmpeg. I used this command (as root) to remove all traces of ffmpeg from my system (redhat)

     find / | grep -w ffmpeg | xargs rm -r -f
     find / | grep -w cpffmpeg | xargs rm -r -f
     find / | grep -w ffmpegscript | xargs rm -r -f
    

    Then I installed libvpx successfully and installed ffmpeg again but have not been able to encode h264 mp4 files since. Since them I have removed ffmpeg completely and recompiled a few times but haven't got it to work again.

    Complete ffmpeg output:

    ffmpeg version N-68141-g4280150-syslint Copyright (c) 2000-2014 the FFmpeg developers
    built on Dec  1 2014 20:24:46 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
    configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl     --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-  amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
    libavutil      54. 15.100 / 54. 15.100
    libavcodec     56. 13.100 / 56. 13.100
    libavformat    56. 15.101 / 56. 15.101
    libavdevice    56.  3.100 / 56.  3.100
    libavfilter     5.  2.103 /  5.  2.103
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'qDqMvfoapXh6FO3KMuYiZCcG.mp4':
    Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2014-12-01 04:18:17
    Duration: 00:00:22.61, start: 0.000000, bitrate: 12028 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 11968 kb/s, 29.88 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2014-12-01 04:18:17
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 121 kb/s (default)
    Metadata:
      creation_time   : 2014-12-01 04:18:17
      handler_name    : SoundHandle
    [libx264 @ 0x2505ee0] using cpu capabilities: none!
    Output #0, mp4, to 'out.mp4':
     Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    Stream #0:0(eng): Video: h264, none, q=2-31, 128 kb/s, 29.97 fps (default)
    Metadata:
      rotate          : 90
      creation_time   : 2014-12-01 04:18:17
      handler_name    : VideoHandle
      encoder         : Lavc56.13.100 libx264
    Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
    Metadata:
      creation_time   : 2014-12-01 04:18:17
      handler_name    : SoundHandle
      encoder         : Lavc56.13.100 libfaac
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    

    Can someone explain why I keep getting this error now?

  • Compiling x264 on a Mac : "No working C compiler found" and "arm-linux-androideabi-gcc : command not found"

    29 novembre 2014, par Xavi Gil

    I am trying to compile the x264 library for Android, following this post.

    I have cloned the x264 project git clone git://git.videolan.org/x264.git and tried to compile with the following configuration:

    NDK=~/development/android-ndk-r10c    
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
    PLATFORM=$NDK/platforms/android-21/arch-arm
    
    ./configure \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --sysroot=$PLATFORM \
    --host=arm-linux \
    --enable-pic \
    --enable-static \
    --disable-cli
    

    The problem is that I get a No working C compiler found. error.

    The conftest.log output:

    $ cat conftest.log 
    ./configure: line 153: arm-linux-androideabi-gcc: command not found
    

    But the arm-linux-androideabi-gcc is the toolchain's bin folder!!

    Looking at this other question it looks like for some reason, even though the file exists, since it is a 64bit Mac, it won't execute the arm-linux-androideabi-gcc file and will return this weird error and log.


    I am in a Mac OS X 10.10 and I have installed the XCode Command Line Tools:

    $ xcode-select -p
    /Applications/Xcode.app/Contents/Developer
    

    GCC version:

    $ gcc --version
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
    Target: x86_64-apple-darwin14.0.0
    Thread model: posix
    

    Can anyone tell me how to fix this please?

  • How to open AVCodec ?

    28 novembre 2014, par Anton Kasabutski

    I'm tired of searching the solution about this theme. Can anybody help?

    Types:

    AVOutputFormat* m_outFormat;
    AVFormatContext* m_formatContext;
    AVCodecContext* m_videoCodecContext;
    AVCodec* m_videoCodec;
    

    Code:

    avcodec_register_all();
    av_register_all();
    m_outFormat = av_guess_format(NULL,filePath().toUtf8().constData(),NULL);
    //filePath ended like ".mp4"
    if (!m_outFormat)
        return; //all is fine
    avformat_alloc_output_context2(&m_formatContext,NULL,NULL,filePath().toUtf8().constData());
    m_formatContext->oformat->video_id = CODEC_ID_H264;
    m_outFormat=m_formatContext->oformat;
    ////////////////////////////////////////////////////////////////////
    m_videoCodec=avcodec_find_encoder(CODEC_ID_H264);
    m_videoStream = avformat_new_stream(m_formatContext,m_videoCodec);
    if (m_videoStream)
        return; //all is fine
    m_videoCodecContext = avcodec_alloc_context3(m_videoCodec);
    m_videoCodecContext->codec_id = CODEC_ID_H264;
    m_videoCodecContext->width = 1280;
    m_videoCodecContext->height = 720;
    m_videoCodecContext->codec_type = AVMEDIA_TYPE_VIDEO;
    m_videoCodecContext->pix_fmt = PIX_FMT_YUV420P;
    av_codec_open2(M_videoCodecContext,m_videoCodec,NULL);
    

    I'm getting an error:

    [libx264 @.....] Codec type or id mismathes.

    av_codec_open2(..) returned (-22 error). Where I did mistake?More info:
    • last ffmpeg
    • Mac Os x 10.10
    • libx264 installed
    • after av_guess_format(...) I've got audio_codec = CODEC_ID_H264, video_codec = CODEC_ID_NONE, long_name MP4(MPEG-4 Part 14) in m_outFormat.
    • after avformat_alloc_context3(...) I've got audio_codec_id = video_codec_id = CODEC_ID_NONE in m_formatContext.
    • after avcodec_find_encoder(CODEC_ID_H264) I've got name = "libx264", id = CODEC_ID_MPEG1VIDEO in m_videoCodec.

      I can share more info if You can say, what do You exactly need.