Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Can't write .mp4 files - Could not open codec 'libx264' : Unspecified error

    17 février 2015, par margaridagomes

    Days ago I installed the latest 2.4 branch withou ffmpeg. I'm using Ubuntu 14.04 and I don't have at all ffmpeg in my Virtual Machine.

    I want to write .mp4 video files and the input files are also .mp4. The input codec is avc1.

    I can't obtain any results, the errors can be seen below.

    Error

    [libx264 @ 0x9357bc0] broken ffmpeg default settings detected
    [libx264 @ 0x9357bc0] use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x9357bc0] preset usage: -vpre  -vpre 
    [libx264 @ 0x9357bc0] speed presets are listed in x264 --help
    [libx264 @ 0x9357bc0] profile is optional; x264 defaults to high
    Could not open codec 'libx264': Unspecified error
    Could not open the output video for write: /home/margarida/exams_2014/Output.mp4
    

    Simplified Code

    int main(int argc, char *argv[]) {
                VideoWriter outputVideo;
    
                // Get Codec Type
                int ex = static_cast(cap.get(CV_CAP_PROP_FOURCC));
    
                // Transform from int to char via Bitwise operators
                char EXT[] = { (char) (ex & 0XFF), (char) ((ex & 0XFF00) >> 8),
                                (char) ((ex & 0XFF0000) >> 16), (char) ((ex & 0XFF000000)
                                        >> 24), 0 };
    
                // Acquire input size
                Size S = Size((int) cap.get(CV_CAP_PROP_FRAME_WIDTH),
                                (int) cap.get(CV_CAP_PROP_FRAME_HEIGHT));
    
                cout << "Input codec type: " << EXT << endl;
    
                // Open the output
                outputVideo.open(newname, ex, cap.get(CV_CAP_PROP_FPS), S, true);
    
                if (!outputVideo.isOpened()) {
                    cout << "Could not open the output video for write " << endl;
                            return -1;
                        }
    
                        while (true) {
                            cap >> frame;
                            if (frame.empty()) {
                                cerr << "nao apanhou frame" << endl;
                                break;
                            }
    
                            cinzento = acinzentar(frame);
                            imshow("Cinzento", cinzento);
    
                            outputVideo.write(cinzento);
    
                            switch(waitKey(10)){
    
                            case 27:
                                //'esc' has been pressed (ASCII value for 'esc' is 27)
                                //exit program.
                                return 0;
    
                            }
                        }
                       return 0;
                    }
    

    My cmake was this:

    cmake -D WITH_TBB=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON -D WITH_FFMPEG=OFF -D WITH_IPP=OFF ..
    

    Can anyone help solving my problem?

    Thanks in advance.

  • Using WebHDFS to play video over HTTP

    3 février 2015, par Qin.Yang

    I used ffmpeg + libx264 to convert file format as H264, then uploaded the file to Hadoop. I used WebHDFS to access the file by HTTP, but can not online play. If I download this file over HTTP, it can play by HTML5 video. My English is poor, hope you know what I mean.

  • how to output a H264 encoded video with ffmpeg in php exec() command

    28 janvier 2015, par Harish Kumar

    I have the following php command to generate a water marked video with a input video, which is working fine. but its not playing in the browser anymore. To do so i research a lot over web and i found that i need to upgrade the libx264 library on my ffmpeg extension on the server which i already did. now what modification do i do to make my command work to generate H264 encode video.

    here is the command i am using

    /usr/local/bin/ffmpeg -i baby.mp4 -i sos.png -filter_complex \"overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2\" -codec:a copy watermarked-video.mp4
    
  • x264 : Using NAL size limitation ruins the stream

    21 janvier 2015, par Dan Tumaykin

    I'm using x264 to compress a video stream from a webcam with this settings:

    x264_param_default_preset(&param, "veryfast", "zerolatency");
    
    param.i_threads = 1;
    param.i_fps_den = 1;
    param.b_annexb = 1;
    
    param.i_keyint_max = 30;
    param.rc.i_rc_method = X264_RC_CRF;
    param.rc.f_rf_constant = 25;
    param.rc.f_rf_constant_max = 35;
    
    param.b_repeat_headers = 1;
    x264_param_apply_profile(&param, "baseline");
    
    param.i_slice_max_size = X264_NAL_MAX_SIZE;
    

    I would like to fit NAL into MTU size, but if I set a small max size, the stream is ruined - it blinks randomly between black and white, with some clues of original image in background. The bigger is the max_size, less probable is for the stream to be ruined. So my question is - can we have small NALUs and a correct video stream?

    UPD: I use FFmpeg as a decoder.

  • What is wrong with this video produced with libx264 ?

    6 janvier 2015, par Natal

    I've been trying to get a c++ wrapper around libx264 (version 142) to work. I am able to produce a video with x264 with no errors during encoding. Most standard video players (QuickTime, VLC...) are NOT able to read it but don't display any errors. However, mplayer is able to read it.

    I am not able to determine what is wrong with it (Corrupt header ? Corrupt data ?).

    The video is available here : https://www.dropbox.com/s/godnip85pezdi89/test_h264.mp4?dl=0

    The class wrapped around libx264 I use to encode the video is here : https://gist.github.com/anonymous/4eb46b838fcf84ed02aa

    Any help to identify what I'm doing wrong would be greatly appreciated.

    Thank you !