Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to set x264 baseline profile with libav in C++

    14 avril 2015, par Denis Loh

    I am writing a small tool, which converts a video into a raw h264 file. These files shall be played later by a SIP phone. I have the following code:

      eccx->pix_fmt = PIX_FMT_YUV420P;
      eccx->width = VIDEO_FRAME_WIDTH;
      eccx->height = VIDEO_FRAME_HEIGHT;
      eccx->time_base.num = 1;
      eccx->time_base.den = VIDEO_FRAMES_PER_SEC;
      eccx->max_b_frames = 0;
    
      eccx->rtp_payload_size = VIDEO_RTP_PAYLOAD_SIZE;
    
      eccx->bit_rate = VIDEO_BIT_RATE;
      eccx->rc_max_rate = VIDEO_BIT_RATE;
      eccx->rc_buffer_size = VIDEO_BIT_RATE * 2;
    
      eccx->flags |= CODEC_FLAG_QP_RD;
      eccx->flags |= CODEC_FLAG_LOW_DELAY;
      eccx->flags |= CODEC_FLAG_QSCALE;
      eccx->flags |= CODEC_FLAG_EMU_EDGE;
    
      eccx->mb_decision = FF_MB_DECISION_SIMPLE;
    
      switch(video){
      case H263:
        break;
      case H263P:
        eccx->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
        break;
      case H264:
        av_dict_set(&options, "vprofile", "baseline", 0);
        eccx->flags2 = CODEC_FLAG2_FASTPSKIP;
        eccx->profile = FF_PROFILE_H264_BASELINE;
        eccx->level = 13;
        break;
      }
    

    When I execute this program I got the following output from libx264:

    [libx264 @ 0x10fad60] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
    [libx264 @ 0x10fad60] profile Main, level 1.3
    

    Why is this still Main profile, though I have set it explicitly to baseline?

    Additionally, I would be really cool, if someone could add some notes which kind of h264 settings are useful for SIP phone calls. Thank you very much!

  • Error in ffmpeg conversion

    9 avril 2015, par Adam Mo.

    I have a VPS 1G RAM with CentOS 6 i386 minimal installed and installed ffmpeg by ffmpeginstaller.com to setup clipbucket 2.7 in the VPS. when I test the ffmpeg by this command:

    wget "http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi"
    ffmpeg -i big_buck_bunny_720p_surround.avi -vcodec libx264 big_buck_bunny_720p_surround-H264.avi
    

    by following this tutorial I get error the output :

    ffmpeg version N-71343-g32e06c4-syslint Copyright (c) 2000-2015 the FFmpeg     developers
      built 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. 22.101 / 54. 22.101
      libavcodec     56. 34.100 / 56. 34.100
      libavformat    56. 30.100 / 56. 30.100
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 13.101 /  5. 13.101
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, avi, from 'big_buck_bunny_720p_surround.avi':
      Metadata:
        encoder         : AVI-Mux GUI 1.17.7, Aug  8 2006  20:59:17
        JUNK            :
      Duration: 00:09:56.46, start: 0.000000, bitrate: 4456 kb/s
        Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p,     1280x720 [SAR 1:1 DAR 16:9], 4001 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc
        Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
        Metadata:
          title           : BBB-Master
    [libx264 @ 0x9360de0] using SAR=1/1
    [libx264 @ 0x9360de0] using cpu capabilities: none!
    x264 [error]: malloc of size 5258784 failed
    Output #0, avi, to 'big_buck_bunny_720p_surround-H264.avi':
      Metadata:
        encoder         : AVI-Mux GUI 1.17.7, Aug  8 2006  20:59:17
        JUNK            :
        Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 24 fps
        Metadata:
          encoder         : Lavc56.34.100 libx264
        Stream #0:1: Audio: mp3, 0 channels, 128 kb/s
        Metadata:
          title           : BBB-Master
          encoder         : Lavc56.34.100 libmp3lame
    Stream mapping:
      Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
      Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    

    I don't know what the problem, can any one help me?

  • How to limit the backward dependency between coded frames in ffmpeg/x264

    26 mars 2015, par Bastian35022

    I am currently playing with ffmpeg + libx264, but i couldn't find a way to limit the backward dependency between coded frames.

    Let me explain what i mean: I want the coded frames to only contain references to at most, let's say, 5 frames in the future. As a result, no frame has to "wait" for more than 5 frames to be coded (makes sense for low latency applications).

    I am aware of the -tune zerolatency option, but that's not what i want; I still want bidirectional prediction.

  • How to change libx264 profile when using ffmpeg backend of OpenCV

    24 mars 2015, par dvhamme

    I am using OpenCV 3.0.0 beta to write a video with VideoWriter vw("out.avi",VideoWriter::fourcc('h','2','6','4'),24,frame.size());

    This calls on the ffmpeg backend (avcodec version 56.26.100), which calls libx264 (build 142). However, apparently it is not possible to specify a libx264 profile from OpenCV, and the default bitrate is too low for my application.

    Where can I change the default behaviour of ffmpeg or possibly libx264 to get higher quality video written from OpenCV?

  • avconv transcoding drops frames

    8 mars 2015, par ziggestardust

    I have a logitech c920 that I can send perfectly fine to a wowza server with this with excelent results:

    ./capture  -o -c0|avconv -f alsa  -b 128k -i hw:1   -re -i - -vcodec copy  -ar 44100 -bufsize 1835k   -map 0:0 -map 1:0 -f flv rtmp://myhost/live/streamname
    

    (capture program is from here: http://derekmolloy.ie/streaming-video-using-rtp-on-the-beaglebone-black/ I'm not using beaglebone, but his capture software runs excellent on my debian pc)

    However, I want to store the h264 stream from the camera down to disk, and later send it in a lower resolution with avconv so I'm playing with libx264

    It seems I can't even do this without getting drops:

    ./capture  -o -c0|avconv -f alsa  -b 128k -i hw:1   -re -i - -vcodec libx264  -ar 44100 -bufsize 1835k   -map 0:0 -map 1:0 -f flv rtmp://myhost/live/streamname
    

    This is what avconv '-v verbose' shows:

    alsa @ 0x864b940] Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'hw:1':
      Duration: N/A, start: 22758.998967, bitrate: N/A
        Stream #0.0: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s
    .................................................................................................................................[h264 @ 0x8659400] max_analyze_duration reached
    [h264 @ 0x8659400] Estimating duration from bitrate, this may be inaccurate
    Input #1, h264, from 'pipe:':
      Duration: N/A, bitrate: N/A
        Stream #1.0: Video: h264 (Constrained Baseline), yuvj420p, 1280x720 [PAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 48 tbc
    Parsing...
    Parsed protocol: 0
    

    ...... and then this :

    Output #0, flv, to 'rtmp://mystream/live/streamname':
      Metadata:
        encoder         : Lavf53.21.1
        Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 200 kb/s
        Stream #0.1: Video: libx264, yuvj420p, 1280x720 [PAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 25 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
      Stream #1:0 -> #0:1 (h264 -> libx264)
    Press ctrl-c to stop encoding
    [alsa @ 0x864b940] ALSA buffer xrun.
    *** drop!
        Last message repeated 39 times
    *** drop!11 fps=  0 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=40    
        Last message repeated 46 times
    *** drop!22 fps= 21 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=87    
    .    Last message repeated 20 timesss
    .....*** drop!   27 fps= 13 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=108    
        Last message repeated 3 timess
    ..*** drop! fps= 10 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=112    
        Last message repeated 5 timesss
    .*** drop!0 fps=  9 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=118    
    .    Last message repeated 5 timess
    .*** drop!2 fps=  9 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=124    
        Last message repeated 6 timesss
    .*** drop!3 fps=  8 q=0.0 size=       0kB time=0.03 bitrate= 116.9kbits/s dup=0 drop=131    
    ^C    Last message repeated 1 times
    *** drop!
        Last message repeated 3 times
    

    I have tried with ffmpeg but it gives same result with dropped frames.

    Any help appreciated