Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Why is x264 not found ?

    14 août 2019, par user11903678

    I want to enable in libav the h264 encoder so I downloaded the library libx264 and installed it statically. However the makefile generated in /lib and /include the .so, .h files for libx264, there is no x264.so file (only c files and header). When I pass the path to the configuration file for Libav it returns the error:

    ERROR: x264 not found

    If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net. Include the log file "config.log" produced by configure as this will help solving the problem.

    The command I used for configure is:

    ./configure --enable-static --prefix=/path_to_library/libav-12.3  --extra-ldflags='-L/path_to_library/libs/x264' --extra-cflags='-I//path_to_library/libs/x264 --static' --enable-libx264 --enable-gpl
    
  • I can't use libx265 or hevc with ffmpeg in nginx

    15 juillet 2019, par Hakan Murat Aksüt

    exec_push /usr/bin/ffmpeg -re -i rtmp://10.254.20.186:1935/$app/$name ar 44100 -vcodec libx264 -g 25 -f flv rtmp://10.254.20.186/live/$name_hi;

    I can use this code in my nginx server. this is code running but dont run while write libx264 instead libx265. The interesting thing is that I can run the following commands on my linux computer without problems.

    ffmpeg -i input.mp4 -c:v libx264 -crf 28 -c:a aac -b:a 128k output.mp4 ffmpeg -i input.mp4 -c:v libx265 -crf 28 -c:a aac -b:a 128k output.mp4 ffmpeg -i input.mp4 -c:v hevc -crf 28 -c:a aac -b:a 128k output264tt.mp4 ffmpeg -i input.mp4 -c:v h264 -crf 28 -c:a aac -b:a 128k output264tt.mp4

  • ffmpeg to hls not running correctly with error :Uncaught RangeError : Source is too large

    4 juillet 2019, par Mohsen Rahnamaei

    I want to add watermark in each video file which produce from hls server. inorder to do that I am using fluent ffmpeg js componnent. and this is my backend code of hls server

     self.provider.getSegmentStream(req, function (err, stream) {
    
    
    
    res.setHeader('Content-Type', CONTENT_TYPE.SEGMENT)
    res.statusCode = 200
    var proc = ffmpeg(req.filePath). videoFilters(
     {
    filter: 'drawtext',
    options: {
      text: 'VERY LONG TEXT VERY VERY VERY VERY LOL!!!',
      fontsize: 36,
      fontcolor: 'white',
      x: '(main_w/2-text_w/2)',
      y: '(text_h/2)+15',
      shadowcolor: 'black',
      shadowx: 2,
      shadowy: 2
    }}
    
     ) 
    
    .videoCodec('libx264')
    
     .audioBitrate('128k')
    
     .audioCodec('aac')
    
    .format('mpegts')
    .on('end', function(stdout, stderr) {
    console.log('Transcoding succeeded !',req.filePath);
    
    })
    
    .on('error', function(err) {
     console.log('an error happened: ' + err.message);
     }).pipe(res ,{end:true})
    

    and in my client i am using this code:

    if(Hls.isSupported())
    {
      console.log('hls is suported');
        var video = document.getElementById('video');
        var hls = new Hls();
        hls.loadSource('http://serverip:8182/streams/stream.m3u8');
        hls.attachMedia(video);
        hls.on(Hls.Events.MANIFEST_PARSED,function()
        {
            video.play();
        });
    }
    else if (video.canPlayType('application/vnd.apple.mpegurl'))
    {
      console.log('hls isnot suported');
    
        video.src = 'http://serverip/streams/stream.m3u8';
        video.addEventListener('canplay',function()
        {
            video.play();
        });
    }
    

    but i have problem becaus its just play first ts file but after that hls has stoped and in console i get this error :

    Uncaught RangeError: Source is too large
    at Uint8Array.set ()
    at e.remuxAudio (blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1)
    at e.remux (blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1)
    at e.append (blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1)
    at e.pushDecrypted (blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1)
    at e.push (blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1)
    at blob:null/44d66ff1-a411-411b-842b-4904552a58a4:1
    

    what should i do

  • Drop P-frame when decoding/encoding mp4 video

    27 juin 2019, par Dzmitry

    I'm decoding/encoding the same mp4 (video/mp4) file using ffmpeg (libAV library) + libx264 encoder. For example, the original video file contains 182 frames:

    [libx264 @ 0x7fb4a843ce00] frame I:2     Avg QP:17.95  size: 13834
    [libx264 @ 0x7fb4a843ce00] frame P:180   Avg QP:19.90  size:  6297
    

    but after the followig decoding/encoding I'm getting file contains 181 frames:

    [libx264 @ 0x7fb4ac421dc0] frame I:2     Avg QP:17.93  size: 13627
    [libx264 @ 0x7fb4ac421dc0] frame P:179   Avg QP:19.77  size:  5946
    

    I've already tried to change AVCodecContext gop_size/max_b_frames/priv_data (profile, preset, tune, x264opts) and I've also read these posts and tried to solve my problem:

    ffpmeg drops last frame when compressing from MP4 to MP4 (libx264)

    ffmpeg/libx264 C API: frames dropped from end of short MP4

    UPD: If I set framerate and timebase = 26/1 and 1/26 and more - frame doesn't drop.

    UPD2: Solved!

    //in function avformat_open_input() add AVDictionary *options:
    av_dict_set(&options, "r", "25", 0);
    av_dict_set(&options, "ignore_editlist", "1", 0);
    

    I expected decoding/encoding videos with all the frames (without changed parameters).

  • capturing x11grab display from ffmpeg giveing "segmentation fault1 q=0.0"

    26 juin 2019, par user2369563

    In Debian 9, I am trying to record screen using ffmpeg over x11grab. it's working great but sometimes its give error as shown below. Any idea what causing this?

    exec error: Error: Command failed: ffmpeg -y  -f x11grab -s 1920x1080 -framerate 30 -i :1.0+0,0 -vsync 1 -c:v libx264 -preset ultrafast -crf 0 -pix_fmt yuv444p output.mkv
    ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
      configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
      libavutil      55. 34.101 / 55. 34.101
      libavcodec     57. 64.101 / 57. 64.101
      libavformat    57. 56.101 / 57. 56.101
      libavdevice    57.  1.100 / 57.  1.100
      libavfilter     6. 65.100 /  6. 65.100
      libavresample   3.  1.  0 /  3.  1.  0
      libswscale      4.  2.100 /  4.  2.100
      libswresample   2.  3.100 /  2.  3.100
      libpostproc    54.  1.100 / 54.  1.100
    [x11grab @ 0x55f87adcffa0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, x11grab, from ':1.0+0,0':
      Duration: N/A, start: 1561540173.584858, bitrate: N/A
        Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
    [libx264 @ 0x55f87adda860] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x55f87adda860] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
    [libx264 @ 0x55f87adda860] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
    Output #0, matroska, to 'output.mkv':
      Metadata:
        encoder         : Lavf57.56.101
        Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
        Metadata:
          encoder         : Lavc57.64.101 libx264
        Side data:
          cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    Segmentation fault1 q=0.0 size=   10942kB time=00:00:02.40 bitrate=37332.4kbits/s speed=0.923x