Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to set x264 baseline profile with libav in C++

    14 avril 2015, par Denis Loh

    I am writing a small tool, which converts a video into a raw h264 file. These files shall be played later by a SIP phone. I have the following code:

      eccx->pix_fmt = PIX_FMT_YUV420P;
      eccx->width = VIDEO_FRAME_WIDTH;
      eccx->height = VIDEO_FRAME_HEIGHT;
      eccx->time_base.num = 1;
      eccx->time_base.den = VIDEO_FRAMES_PER_SEC;
      eccx->max_b_frames = 0;
    
      eccx->rtp_payload_size = VIDEO_RTP_PAYLOAD_SIZE;
    
      eccx->bit_rate = VIDEO_BIT_RATE;
      eccx->rc_max_rate = VIDEO_BIT_RATE;
      eccx->rc_buffer_size = VIDEO_BIT_RATE * 2;
    
      eccx->flags |= CODEC_FLAG_QP_RD;
      eccx->flags |= CODEC_FLAG_LOW_DELAY;
      eccx->flags |= CODEC_FLAG_QSCALE;
      eccx->flags |= CODEC_FLAG_EMU_EDGE;
    
      eccx->mb_decision = FF_MB_DECISION_SIMPLE;
    
      switch(video){
      case H263:
        break;
      case H263P:
        eccx->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
        break;
      case H264:
        av_dict_set(&options, "vprofile", "baseline", 0);
        eccx->flags2 = CODEC_FLAG2_FASTPSKIP;
        eccx->profile = FF_PROFILE_H264_BASELINE;
        eccx->level = 13;
        break;
      }
    

    When I execute this program I got the following output from libx264:

    [libx264 @ 0x10fad60] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
    [libx264 @ 0x10fad60] profile Main, level 1.3
    

    Why is this still Main profile, though I have set it explicitly to baseline?

    Additionally, I would be really cool, if someone could add some notes which kind of h264 settings are useful for SIP phone calls. Thank you very much!

  • How to encode (ffmpeg x264) with continuous seek

    13 avril 2015, par CV_User

    I have a batch file that encodes video files from 'Source' folder to 'Target' folder.

    The batch file content is:

    for %%a in ("Source*.*") do @echo DirectShowSource("%%a") >> "batchScript.avs" && @echo MSharpen(10,120) >> "batchScript.avs" && ffmpeg -i "batchScript.avs" -n -c:v libx264 -crf 24 -c:a libmp3lame -b:a 192k "Target\%%~na.mp4" && del "batchScript.avs" pause

    I'm not sure why, but when I playback the encoded files in media player classic I can only jump to discrete jumps in time and not to the exact time I clicked on.

    What can be done so this doesn't happen?

    Thanks all!

  • Generating movie from python without saving individual frames to files

    8 avril 2015, par Paul

    I would like to create an h264 or divx movie from frames that I generate in a python script in matplotlib. There are about 100k frames in this movie.

    In examples on the web [eg. 1], I have only seen the method of saving each frame as a png and then running mencoder or ffmpeg on these files. In my case, saving each frame is impractical. Is there a way to take a plot generated from matplotlib and pipe it directly to ffmpeg, generating no intermediate files?

    Programming with ffmpeg's C-api is too difficult for me [eg. 2]. Also, I need an encoding that has good compression such as x264 as the movie file will otherwise be too large for a subsequent step. So it would be great to stick with mencoder/ffmpeg/x264.

    Is there something that can be done with pipes [3]?

    [1] http://matplotlib.sourceforge.net/examples/animation/movie_demo.html

    [2] http://stackoverflow.com/questions/2940671

    [3] http://www.ffmpeg.org/ffmpeg-doc.html#SEC41

  • How to limit the backward dependency between coded frames in ffmpeg/x264

    26 mars 2015, par Bastian35022

    I am currently playing with ffmpeg + libx264, but i couldn't find a way to limit the backward dependency between coded frames.

    Let me explain what i mean: I want the coded frames to only contain references to at most, let's say, 5 frames in the future. As a result, no frame has to "wait" for more than 5 frames to be coded (makes sense for low latency applications).

    I am aware of the -tune zerolatency option, but that's not what i want; I still want bidirectional prediction.

  • How to use gstreamer to save webcam video to file ?

    2 mars 2015, par sav

    I've been trying to get emgu to save same webcam video to file

    The problem is opencv only ssupports avi, and avi does not seem to suit a format like X264 very well.

    Could I use Gstreamer to do this for me in C?

    It would be good if I could choose the file format and container type too. It would be good if I could use a format like schrodinger dirac.

    I'm new to GStreamer so I'm not quite sure if I'm on the right track here.

    EDIT

    I've managed to capture the webcam video using

    gst-launch-0.10 ksvideosrc ! autovideosink

    Now how to transcode this to a format like H264 or dirac ...?

    EDIT

    gst-launch-0.10 ksvideosrc num-buffers=10 ! decodebin2 ! ffmpegcolorspace ! x264enc ! matroskamux ! filesink location=video.mkv

    This seems to create a file, but VLC player can't read it.