Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Whats the difference between the output of mencoder and libx264 ?

    30 septembre 2013, par عبدالمؤمن كاظم

    i want to know the difference between video output of these two encoders (mencoder and libx264). i guess they're not, since the video information of the codec have different names. thanks in advance.

  • Stream output of x264_encoder_encode over rtsp or rtp [closed]

    21 août 2013, par user2660369

    How can I stream the h264 created with x264_encoder_encode over rtp/rtsp? What parameters have to be passed to the libx264-encoder? Is there a way to keep the framerate variable, so that the viewer will display the frame when it gets it, and is not to upset if the frame is a bit late?

  • Convert OpenGL output to H264 with x264

    7 août 2013, par user2660369

    I want to convert the output of an OpenGL Program to h264 and stream the output. I got collected most of the code somewhere and I get an output file but I have no Idea what to do with it, or if it is valid. Currently the output is just saved in file.h264.

    Edit: "Global" Variables

        x264_param_t param;
        x264_t* encoder;
        x264_picture_t pic_in;
        x264_picture_t pic_out;
    
        x264_nal_t *headers;
        int i_nal;
        FILE* pFile;
    

    My init function:

    initX264() {
        pFile = fopen("file.h264", "wb");
    
        x264_param_t param;
        x264_param_default_preset(&param, "veryfast", "zerolatency");
        param.i_threads = 1;
        param.i_width = 1024;
        param.i_height = 768;
        param.i_fps_num = 30;
        param.i_fps_den = 1;
    
        param.i_keyint_max = 30;
        param.b_intra_refresh = 1;
    
        param.rc.i_rc_method = X264_RC_CRF;
        param.rc.f_rf_constant = 25;
        param.rc.f_rf_constant_max = 35;
    
        param.b_annexb = 0;
        param.b_repeat_headers = 0;
    
        param.i_log_level = X264_LOG_DEBUG;
    
        x264_param_apply_profile(&param, "baseline");
    
        encoder = x264_encoder_open(&param);
        x264_picture_alloc(&pic_in, X264_CSP_I420, 1024, 768);
    
        x264_encoder_parameters( encoder, &param );
    
        x264_encoder_headers( encoder, &headers, &i_nal );
    
        int size = headers[0].i_payload + headers[1].i_payload + headers[2].i_payload;
        fwrite( headers[0].p_payload, 1, size, pFile);
    }
    

    This goes in the Render function and is executed about 30 times per second:

        GLubyte *data = new GLubyte[3 * 1024 * 768];
        GLubyte *PixelYUV = new GLubyte[3 * 1024 * 768];
    
        glReadPixels(0, 0, 1024, 768, GL_RGB, GL_UNSIGNED_BYTE, data);
        RGB2YUV(1024, 768, data, PixelYUV, PixelYUV + 1024 * 768, PixelYUV + 1024 * 768 + (1024 * 768) / 4, true);
        pic_in.img.plane[0] = PixelYUV;
        pic_in.img.plane[1] = PixelYUV + 1024 * 768;
        pic_in.img.plane[2] = PixelYUV + 1024 * 768 + (1024 * 768) / 4;
    
        x264_nal_t* nals;
        int i_nals;
        int frame_size = x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out);
    
        if( frame_size )
        {
            fwrite( (char*)nals[0].p_payload, frame_size, 1, pFile );
    
        }
    

    I got the GRB2YUV funktion from http://svn.gnumonks.org/trunk/21c3-video/cutting_tagging/tools/mpeg4ip-1.2/server/util/rgb2yuv/rgb2yuv.c

    The output looks like

    x264 [debug]: frame=   0 QP=11.14 NAL=3 Slice:I Poc:0   I:3072 P:0    SKIP:0    size=21133 bytes
    x264 [debug]: frame=   1 QP=20.08 NAL=2 Slice:P Poc:2   I:0    P:14   SKIP:3058 size=72 bytes
    x264 [debug]: frame=   2 QP=18.66 NAL=2 Slice:P Poc:4   I:0    P:48   SKIP:3024 size=161 bytes
    x264 [debug]: frame=   3 QP=18.23 NAL=2 Slice:P Poc:6   I:0    P:84   SKIP:2988 size=293 bytes
    

    On Linux file file.h264 returns data.

  • Create MP4 for HTML5 video with FFMPEG

    7 août 2013, par Kris

    I'm trying to create an MP4 file with FFMPEG to play with a HTML5 video tag.

    I found some sample codes that use libx264, but when I tried, FFMPEG gave me an "unknown encoder libx264" error.

    I asked my host to install it on my server, and got the following reply:

    After review from our L3 group I am informed that x264 is not supported with FFMPEG any longer. That was a library that went with FFMPEG-PHP that is not supported at all by anyone.

    In order to get that to work with FFMPEG you would need to contact the developers of the FFMPEG software to get assistance with that as it is outside our scope of support.

    I looked everywhere online, but can't seem to find an answer to this. If libx264 is not supported anymore, how is everyone else doing it? Still libx264 with an older FFMPEG version, or some other way?

  • ffserver — live streaming to iOS, Android, Flash

    12 juillet 2013, par Stanislav Saranchin

    I'm creating live streaming transcoding from IPTV to Web into several formats like WebM, Flash, HLS using FFServer and FFMpeg at once.

    ffserver.conf located at http://pastebin.com/hUky5Jsh

    Translating of source-stream to FFServer:

    ffmpeg -i udp://239.192.192.1:1234 -s 560x320 http://localhost:8090/feed.ffm
    

    FFServer's logs showing next:

    Fri Jul 12 11:39:50 2013 127.0.0.1 - - New connection: GET /feed.ffm
    Fri Jul 12 11:39:50 2013 127.0.0.1 - - [GET] "/feed.ffm HTTP/1.1" 200 4175
    Fri Jul 12 11:39:50 2013 127.0.0.1 - - New connection: POST /feed.ffm
    Fri Jul 12 11:39:50 2013 Feed '/tmp/feed.ffm' stream number does not match registered feed
    Fri Jul 12 11:39:50 2013 127.0.0.1 - - [POST] "/feed.ffm HTTP/1.1" 200 4096
    

    My brain is very hot after googling solution on the Internet.


    FFServer:

    ffserver version N-37738-g15cee5e Copyright (c) 2000-2013 the FFmpeg developers
      built on Jul 11 2013 17:01:41 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
      configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
    

    FFMpeg:

    ffmpeg version N-37738-g15cee5e Copyright (c) 2000-2013 the FFmpeg developers
    built on Jul 11 2013 17:01:41 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
    configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include     --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --extra-libs=-ldl --enable-gpl     --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora     --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
    

    Source-stream is:

    Input #0, mpegts, from 'udp://239.192.192.1:1234':
      Duration: N/A, start: 80091.027433, bitrate: 192 kb/s
      Program 702
        Stream #0:0[0x322]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 544x576 [SAR 32:17 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #0:1[0x386](rus): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s