Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to use x264 source code after compiling it

    8 mai 2016, par Zia Khattak

    I need to use the x264 code to compress and stream video from a camera in real time as part of my university project (first using computer and then dsp kit) (and vary quantization value when required). I am totally new to this domain and have absolutely no background.

    So far I have compiled the code using the given method in http://www.ayobamiadewole.com/Blog/How-to-build-x264-or-libx264.dll-in-Windows and created the x264.exe and libx264.dll

    I need help with what to do next in order to use the code for my purpose.

    All help is appreciated.

  • CPU spike when transitioning from a still image

    21 avril 2016, par lagnat

    After streaming a still image (with x264) for a long period of time, the transition to live video makes the CPU spike to 100% for a period of time proportionally equal to how long the still image was streaming. More specifically, transitioning after a minute will result in a CPU spike lasting about 15 seconds. Transitioning after 30 minutes will result in that spike lasting closer to 3 minutes.

    Does this symptom make any sense and is there anything I can do about it?

  • Why sliced thread affect so much on realtime encoding using ffmpeg x264 ?

    13 avril 2016, par CurtisGuo

    I'm using ffmpeg libx264 to encode a 720p screen captured from x11 in realtime with a fps of 30. when I use -tune zerolatency paramenter, the average encode time per-frame can be as large as 12ms with profile baseline.

    After a study of the ffmpeg x264 source code, I found that the key parameter leading to such long encode time is sliced-threads which enabled by -tune zerolatency. After disabled using -x264-params sliced-threads=0 the encode time can be as low as 2ms

    And with sliced-threads disabled, the CPU usage will be 40%, while only 20% when enabled.

    Can someone explain the details about this sliced-thread? Especially in realtime encoding(assume no frame is buffered to be encoded. only encode when a frame is captured).

  • How to encode H.264 video using FFmpeg C API and then open the output with a media player ?

    4 avril 2016, par GummiB

    I'm trying to encode a H.264 video with the FFMPEG C API. I have successfully compiled and executed the decoding/encoding example provided by FFMPEG.

    The problem I'm facing is that the .mpg file (encoded with AV_CODEC_ID_MPEG1VIDEO) the example creates works. Windows creates a thumbnail and everything. On the other hand the .h264 (encoded with AV_CODEC_ID_H264) file does not. When I try to play the file in VLC the play/pause button just flickers, no thumbnail in windows, no nothing.

    During encoding libx264 reports the following:

    [libx264 @ 004b81a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 004b81a0] profile High, level 1.3
    [libx264 @ 004b81a0] frame I:3     Avg QP:26.79  size:  2116
    [libx264 @ 004b81a0] frame P:12    Avg QP:26.60  size:   789
    [libx264 @ 004b81a0] frame B:10    Avg QP:31.39  size:   499
    [libx264 @ 004b81a0] consecutive B-frames: 20.0% 80.0%
    [libx264 @ 004b81a0] mb I  I16..4: 78.3% 11.6% 10.1%
    [libx264 @ 004b81a0] mb P  I16..4: 77.4%  0.6%  0.1%  P16..4: 20.3%  0.7%  0.9%  0.0%  0.0%    skip: 0.0%
    [libx264 @ 004b81a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  9.4%  0.2%  0.0%  direct:11.0%  skip:79.4%  L0:25.4% L1:35.4% BI:39.2%
    [libx264 @ 004b81a0] final ratefactor: 17.03
    [libx264 @ 004b81a0] 8x8 transform intra:3.4% inter:31.3%
    [libx264 @ 004b81a0] direct mvs  spatial:0.0% temporal:100.0%
    [libx264 @ 004b81a0] coded y,uvDC,uvAC intra: 4.4% 35.8% 1.6% inter: 1.3% 34.5% 9.5%
    [libx264 @ 004b81a0] i16 v,h,dc,p:  0%  0%  0% 100%
    [libx264 @ 004b81a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 20% 17% 49%  0%  0%  0%  1%  6%
    [libx264 @ 004b81a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14%  7% 18% 45%  2%  7%  2%  3%  2%
    [libx264 @ 004b81a0] i8c dc,h,v,p:  2%  6%  4% 88%
    [libx264 @ 004b81a0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 004b81a0] ref P L0: 95.6%  1.6%  2.2%  0.5%  0.2%
    [libx264 @ 004b81a0] ref B L0: 67.5% 28.5%  3.2%  0.8%
    [libx264 @ 004b81a0] kb/s:166.45
    

    "ffprobe.exe test.h264 -show_streams" returns

    [STREAM]
    index=0
    codec_name=h264
    codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
    profile=High
    codec_type=video
    codec_time_base=1/50
    codec_tag_string=[0][0][0][0]
    codec_tag=0x0000
    width=352
    height=288
    has_b_frames=1
    sample_aspect_ratio=0:1
    display_aspect_ratio=0:1
    pix_fmt=yuv420p
    level=13
    timecode=N/A
    id=N/A
    r_frame_rate=50/2
    avg_frame_rate=25/1
    time_base=1/1200000
    start_pts=N/A
    start_time=N/A
    duration_ts=N/A
    duration=N/A
    bit_rate=N/A
    nb_frames=N/A
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    [/STREAM]
    

    There you can see:

    start_time=N/A
    duration_ts=N/A
    duration=N/A
    

    I have tried countless changes to the AVCodecContext and multitude of parameters options to av_opt_set function. Still no luck getting a working H.264 video. I have even tried different builds of FFmpeg. No luck.

    I'm using the "FFmpeg git-0fb64da 32-bit Dev" build from Zeranoe and MinGw 4.7.2

  • Q.For encoding error of ffmpeg

    21 mars 2016, par 社畜根性

    I ran the following command.

    ffmpeg -i test.mp4 -threads 2 -codec:v libx264 -s:v 1280x720 -aspect:v 16:9 -b:v 256k -map 0 -f segment -segment_format mpegts -segment_time 10 -segment_list stream.m3u8 streamfiles/stream%03d.ts
    

    Execution result

    ffmpeg version N-75926-gce0834b Copyright (c) 2000-2015 the FFmpeg developers
      built with gcc 4.6 (Debian 4.6.3-14+rpi1)
      configuration: --arch=armel --target-os=linux --enable-shared --enable-gpl --enable-libx264 --enable-nonfree
      libavutil      55.  3.100 / 55.  3.100
      libavcodec     57.  5.100 / 57.  5.100
      libavformat    57.  3.100 / 57.  3.100
      libavdevice    57.  0.100 / 57.  0.100
      libavfilter     6. 11.100 /  6. 11.100
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.100 /  2.  0.100
      libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.40.100
      Duration: 00:00:03.28, start: 0.000000, bitrate: 10159 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 10156 kb/s, 25 fps, 25 tbr, 1200k tbn, 2400k tbc (default)
        Metadata:
          handler_name    : VideoHandler
    Illegal instruction
    

    The result is that an error occurred. Someone told me that it's an error if you do not put the option to ./configure of libx264. That option is the --extra-cflags='-march=armv6' --extra-ldflags='-march=armv6'. Otherwise it would use the instruction of unsupported.

    So I ran ./configure with the option, then I ran the make and now I'm getting an error message:

    common/arm/quant-a.S: Assembler messages:
    common/arm/quant-a.S:362: Error: selected processor does not support ARM mode `rbit r1,r1'
    common/arm/quant-a.S:363: Error: selected processor does not support ARM mode `rbit r1,r1'
    Makefile:217: recipe for target 'common/arm/quant-a.o' failed
    make: *** [common/arm/quant-a.o] Error 1
    

    I do not know the meaning of this error. How should you deal me this error?

    I use the machine is Raspberry PI B+ and my OS is Raspbian. I want to use ffmpeg and libx264.

    Any advice and suggestions will be greatly appreciated.