Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • What is the difference between libx264 and h264_nvenc ?

    18 août 2019, par Jonathan Morrall

    I am trying to encode some videos but when I use the libx264 they don't work but change the codec to h264_nvenc and they play.

    If I change the profile to baseline when using the libx264 the videos play.

    what is the difference? I could use the h264_nvenc but I want to use the libx264 for the better quality for storage.

    My code

    bin\ffmpeg -i "Input-File" -c:v h264_nvenc -bf 3 -b_strategy 2 -temporal-aq 1 -rc-lookahead 20 -profile:v high -preset slow -rc vbr_hq -rc:v vbr_hq -qmin 0 -cq:v 19 -b:v 900k -maxrate:v 5000k -bufsize 2000K -c:a aac -ar 48000 -b:a 128k "Output-File.mp4"
    
  • 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).