Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Ubuntu ffmpeg can't use libx264

    27 mai 2021, par user1315621

    Command

    ffprobe rtsp://localhost/myvideo -codec:v libx264 -show_frames -of csv
    

    Output

    Failed to set value 'libx264' for option 'codec:v': Option not found
    

    But libx264 seems to be installed - sudo apt install libx264-dev:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    libx264-dev is already the newest version (2:0.152.2854+gite9a5903-2).
    
  • how to put SPS/PPS before each keyframe while encode h264 with ffmpeg ?

    18 mai 2021, par woder

    I see there is an flag can put pps and sps before each keyframe

    // x264.h
    int b_repeat_headers;       /* put SPS/PPS before each keyframe */
    

    but I don't know how to enable it while encode with ffmpeg; I search ffmpeg codec library wrapper file libx264.c that I only find b_repeat_headers will be set to 0 if codec context flag AV_CODEC_FLAG_GLOBAL_HEADER is set

        if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)
            x4->params.b_repeat_headers = 0;
    

    but I don't find where to set b_repeat_headers to 1, how can I make it?

  • How to use ffmpeg for streaming mp4 via websocket

    18 mai 2021, par curtiss

    I've written a sample in nodejs which streams some input to the client via websocket connection in mp4 format. On the client side, the mp4 packages are added to a MediaSourceBuffer.

    This runs fine, but only if the client gets the stream from the beginning with the first package. So another client can't play the current Stream, because he won't get the Stream from the beginning.

    I tried (try&error) to save the first package ffmpeg sends and send this at the beginning of a new connection, then the current stream. Then the MediaSourceBuffer breaks because of encoding error..

    Here is the ffmpeg command :

    -i someInput -g 59 
    -vcodec libx264 -profile:v baseline 
    -f mp4 -movflags empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof
    -reset_timestamps 1
    -
    

    The part "empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof" should make the Streampackages independent in putting the moovatom at the beginning of each part and sizing the parts in 59 frames each by keyframe, so I don't get it why I can't view the Stream beginning after the start.

  • Error initializing output stream ffmpeg on Rasbpi converting jpg to video

    5 avril 2021, par Jake

    I have a folder with thousands of jpgs at 1024x768 that I want to convert into a single video for playback.

    The error I get is Error initializing output stream 73:0 -- Error while opening encoder for output stream #73:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed!

    Here's my input $ ffmpeg -i Timelapse/*.jpg -c:v libx264 -preset ultrafast -crf 0 output.mkv -y

    What is strange is it errors on a specific numbered output stream. It seems to be either 71:0, 72:0, or 73:0. I thought it was something wrong with the file it is attempting to process in the given stream but the resolution is all the same (as I've seen errors when its not divisible by 2). I've deleted the 71st-73rd image in hopes it was somehow messed up but that doesn't help either. I've ensured my libx264 is installed correctly as well.

    Any suggestions?

    Terminal output example

    Terminal output example

  • Why is ffmpeg transcoding speed going down over time ?

    24 mars 2021, par Nikola R.

    I'm executing basic ffmpeg command to transcode input MP4 video to output MP4 video (both using H264 as video codec, and stripping out audio, for simplicity):

    ffmpeg -i input-video.mp4 -b:v 20000k -an -vcodec libx264 output-video.mp4
    

    Transcoding is initially pretty fast (around 60-70 fps for first 20 or so frames), and then starts dropping steadily, ending at around 30 fps after 5000 frames.

    Is this inherent behavior? If so, why does it happen? Also, is there any better option for the command line that would improve speed (besides using -threads)?

    Would it be better to cut the input video and process it as smaller chunks, getting overall higher speed per sequence? (I'm afraid that chunking might affect encoder's RD optimization)