Newest 'x264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • I B P frames order and relative time - ffmpeg recorded video not smooth (stuttering)

    8 septembre 2022, par Francesco

    I'm trying to understand why my recorded video is not smooth. I'm using a USB capture device and OBS/ffmpeg software. OBS Stats doesn't show any skipped/missed frames during recording.

    Using this command on the resulting file (H264, mkv)

    ffprobe -v quiet -pretty -print_format csv -show_entries "frame=coded_picture_number,pkt_pts,pkt_duration,pict_type," -select_streams v:0 test.mkv > output.csv
    

    I see an output like this one:

    frame,33,33,I,0
    frame,67,33,P,1
    frame,100,33,I,2
    frame,133,33,I,3
    frame,167,33,P,4
    frame,200,33,I,5
    frame,233,33,P,6
    frame,267,33,I,7
    frame,300,33,B,9
    frame,333,33,P,8
    frame,367,33,I,10
    frame,400,33,P,11
    frame,433,33,I,12
    frame,467,33,B,14
    frame,500,33,P,13
    frame,533,33,I,15
    frame,567,33,P,16
    frame,600,33,I,17
    frame,633,33,B,19
    frame,667,33,P,18
    frame,700,33,I,20
    frame,733,33,B,22
    frame,767,33,P,21
    frame,800,33,I,23
    frame,833,33,B,25
    frame,867,33,P,24
    frame,900,33,I,26
    frame,933,33,B,28
    frame,967,33,P,27
    frame,1000,33,I,29
    ...
    

    If I understood correclty the last number refers to presentation order and the second number is the video relative time. Frame number 9 (type B) is shown at 300 ms while frame number 8 (type P) is shown at 333 ms.

    Is it correct? If not, is this the stuttering source and is there a way for fixing the order?

  • How can i encode a video using a QP map in x264 ? [closed]

    5 septembre 2022, par JustABeginner

    I have a qp table contains x and y coordinates, poc and QP value of each block.

    How can I change x264 source code so that I could encode a video with this table?

    I tried using qpfile but its for each frame, not each blocks.

    Hope someone could help me.

    Here's the table I mentioned:

  • x264 : How to Correctly Use quant_offsets ?

    25 août 2022, par Eynnzerr

    Suppose I need to encode different regions with different QPs in one frame, i.e. RoI(regions of interest) encoding. I searched all over the internet and was only told that quant_offsets can meet my demand. However, none of them told me exactly how to use it, and I can't find any official documentation about it. I read the source code of x264 and did experiments, and find it only adds an offset to the qp decision x264 has made, rather than exactly set the qp value I want.

    Is there a possible way that I can have x264 encode these regions using the qp value I've explictly given instead of adding offsets based on what it decided on its own? Many thanks!

  • Generating movie from python without saving individual frames to files

    31 juillet 2022, 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] How does one encode a series of images into H264 using the x264 C API?

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

  • h264 lossless coding

    19 juillet 2022, par cloudraven

    Is it possible to do completely lossless encoding in h264? By lossless, I mean that if I feed it a series of frames and encode them, and then if I extract all the frames from the encoded video, I will get the exact same frames as in the input, pixel by pixel, frame by frame. Is that actually possible? Take this example:

    I generate a bunch of frames, then I encode the image sequence to an uncompressed AVI (with something like virtualdub), I then apply lossless h264 (the help files claim that setting --qp 0 makes lossless compression, but I am not sure if that means that there is no loss at any point of the process or that just the quantization is lossless). I can then extract the frames from the resulting h264 video with something like mplayer.

    I tried with Handbrake first, but it turns out it doesn't support lossless encoding. I tried x264 but it crashes. It may be because my source AVI file is in RGB colorspace instead of YV12. I don't know how to feed a series of YV12 bitmaps and in what format to x264 anyway, so I cannot even try.

    In summary what I want to know if that is there a way to go from

    Series of lossless bitmaps (in any colorspace) -> some transformation -> h264 encode -> h264 decode -> some transformation -> the original series of lossless bitmaps

    If there a way to achieve this?

    EDIT: There is a VERY valid point about lossless H264 not making too much sense. I am well aware that there is no way I could tell (with just my eyes) the difference between and uncompressed clip and another compressed at a high rate in H264, but I don't think it is not without uses. For example, it may be useful for storing video for editing without taking huge amounts of space and not losing quality and spending too much encoding time every time the file is saved.

    UPDATE 2: Now x264 doesn't crash. I can use as sources either avisynth or lossless yv12 lagarith (to avoid the colorspace compression warning). Howerver, even with --qp 0 and a rgb or yv12 source I still get some differences, minimal but present. This is troubling, because all the information I have found on lossless predictive coding (--qp 0) claims that the whole encoding should be lossless, but I am unable to verifiy this.