Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Tune FFMPEG h264 decoder

    9 avril 2012, par user1002473

    I use FFMPEG avcodec for decode live video. avcodec_decode_video2 function if be more exactly (libx264). How can i make a less decoding time for each frame? Now I have 20 ms by each frame (frame size about 1,5 kbyte)

    Thanks

  • x264 Faster decode speed

    26 mars 2012, par ddlshack

    I'm using x264 to encode videos for a flash video streaming site. I use -tune fastdecode, which turns off cabac and deblock, which I've heard are the features which take most cpu to decode. However, I've still had reports of jerky video playback and high cpu usage.

    Heres a typical encode command:

    ffmpeg -y -i $infile -c:v libx264 -crf 28 -preset slow -vprofile main -tune fastdecode -f h264 -r:v 29.970 -vf "..." $outfile
    

    My users view the videos using flash, on all desktop OSes and a wide variety of hardware.

    Which encoding options are the most cpu-intense, and what are the recommended options for 'reasonable' playback on most machines?

  • Encoding video only FLV

    25 mars 2012, par NadavRub

    I am trying to generate a video only FLV file, I am using:

    1. libx264 + ffmpeg
    2. 30 fps ( fixed )
    3. playback is done using VLC 2.0.1 and flowplayer

    When playing the FLV the frame-rate seems ~1 frame per sec, following is the way I cfg ffmpeg:

    AVOutputFormat* fmtOutput = av_oformat_next(0);
    while((0 != fmtOutput) && (0 != strcmp(fmtOutput->name, "flv")))
        fmtOutput = av_oformat_next(fmtOutput);
    m_pFmtCtxOutput          = avformat_alloc_context();
    m_pFmtCtxOutput->oformat = fmtOutput;
    
    AVStream* pOutVideoStream= av_new_stream(m_pFmtCtxOutput, pInVideoStream->id);
    AVCodec*  videoEncoder   = avcodec_find_encoder(CODEC_ID_H264);
    
    pOutVideoStream->codec->width    = 640;
    pOutVideoStream->codec->height   = 480;
    pOutVideoStream->codec->level    = 30;
    pOutVideoStream->codec->pix_fmt  = PIX_FMT_YUV420P;
    pOutVideoStream->codec->bit_rate = 3000000;
    
    pOutVideoStream->cur_dts         = 0;
    pOutVideoStream->first_dts       = 0;
    pOutVideoStream->index           = 0;
    pOutVideoStream->avg_frame_rate  = (AVRational){ 30, 1 };
    pOutVideoStream->time_base       =
    pOutVideoStream->codec->time_base= (AVRational){ 1, 30000 };
    pOutVideoStream->codec->gop_size = 30;
    %% Some specific libx264 settings %%
    m_dVideoStep                     = 1000;// packet dts/pts is incremented by this amount each frame
    
    pOutVideoStream->codec->flags   |= CODEC_FLAG_GLOBAL_HEADER;
    avcodec_open(pOutVideoStream->codec, videoEncoder);
    

    The resulting file seems OK, with the exception of the playback frame-rate.
    having in mind that:

    1. pOutVideoStream->avg_frame_rate = (AVRational){ 30, 1 };
    2. pOutVideoStream->time_base = (AVRational){ 1, 30000 };
    3. pOutVideoStream->codec->time_base= (AVRational){ 1, 30000 };
    4. For each frame I increment the dts/pts by 1000

    What am I doing wrong here? why the file is playing choppy ( ~1 fps )?

    Any help will be appreciated.

    Nadav at Sophin

  • VLC libx264 streaming muxed as FLV

    24 mars 2012, par Jan Novák

    I have a question on streaming output of libx264. My scenario is that Iam capturing video from webcam, encoding with x264 and then streaming data to flash, muxed as FLV. For muxing, Im using output/flv_bitstream.h, included in libx264 budle. The only modification of muxer, that I made, is that instead of fwrite() im usig send() to transfer data via socket... Encoding library is working fine. If I save output (even muxed), vlc player is able to play it. But, when it goes to data transfer via socket, vlc and flash are not cooperating. The weird thig is, that if Im sending data to vlc player thru socket, it waits till transmission end and then plays video from buffer. But what I need is to play live stream.

    I also tryed to read flv file and send it to vlc of flash tag by tag and it is working fine.

    Any suggestions?

  • What is the minimum amount of metadata is needed to stream only video using libx264 to encode at the server and libffmpeg to decode at the client ?

    19 mars 2012, par cloudraven

    I want to stream video (no audio) from a server to a client. I will encode the video using libx264 and decode it with ffmpeg. I plan to use fixed settings (at the very least they will be known in advance by both the client and the server). I was wondering if I can avoid wrapping the compressed video in a container format (like mp4 or mkv).

    Right now I am able to encode my frames using x264_encoder_encode. I get a compressed frame back, and I can do that for every frame. What extra information (if anything at all) do I need to send to the client so that ffmpeg can decode the compressed frames, and more importantly how can I obtain it with libx264. I assume I may need to generate NAL information (x264_nal_encode?). Having an idea of what is the minimum necessary to get the video across, and how to put the pieces together would be really helpful.