[x265] [PATCH] cli: fill pts if source does not provide one

Xinyue Lu maillist at 7086.in
Thu Apr 2 11:07:38 CEST 2015


# HG changeset patch
# User Xinyue Lu <i at 7086.in>
# Date 1427965409 25200
#      Thu Apr 02 02:03:29 2015 -0700
# Branch Yuuki
# Node ID 8cdf6fb6a335071dc0fc29510dbb8c0c7d301ee8
# Parent  ac85c775620f1dcb0df056874633cbf916098bd2
cli: fill in pts on input

Also add timebase to x265_param struct to work with pts.

diff -r ac85c775620f -r 8cdf6fb6a335 source/common/param.cpp
--- a/source/common/param.cpp	Tue Mar 31 20:04:28 2015 -0500
+++ b/source/common/param.cpp	Thu Apr 02 02:03:29 2015 -0700
@@ -122,6 +122,11 @@
      param->bEmitHRDSEI = 0;
      param->bEmitInfoSEI = 1;

+    param->fpsNum = 0;
+    param->fpsDenom = 0;
+    param->timebaseNum = 0;
+    param->timebaseDenom = 0;
+
      /* CU definitions */
      param->maxCUSize = 64;
      param->minCUSize = 8;
diff -r ac85c775620f -r 8cdf6fb6a335 source/input/input.h
--- a/source/input/input.h	Tue Mar 31 20:04:28 2015 -0500
+++ b/source/input/input.h	Thu Apr 02 02:03:29 2015 -0700
@@ -48,6 +48,8 @@
      int sarWidth;
      int sarHeight;
      int frameCount;
+    int timebaseNum;
+    int timebaseDenom;

      /* user supplied */
      int skipFrames;
diff -r ac85c775620f -r 8cdf6fb6a335 source/x265.cpp
--- a/source/x265.cpp	Tue Mar 31 20:04:28 2015 -0500
+++ b/source/x265.cpp	Thu Apr 02 02:03:29 2015 -0700
@@ -365,6 +365,10 @@
          this->framesToBeEncoded = info.frameCount - seek;
      param->totalFrames = this->framesToBeEncoded;

+    /* Force CFR and timebase until we have VFR support */
+    param->timebaseNum = param->fpsDenom;
+    param->timebaseDenom = param->fpsNum;
+
      if (x265_param_apply_profile(param, profile))
          return true;

@@ -560,6 +564,8 @@
                  ditherImage(*pic_in, param->sourceWidth, param->sourceHeight, errorBuf, X265_DEPTH);
                  pic_in->bitDepth = X265_DEPTH;
              }
+            /* Overwrite PTS */
+            pic_in->pts = pic_in->poc;
          }

          int numEncoded = x265_encoder_encode(encoder, &p_nal, &nal, pic_in, pic_recon);
diff -r ac85c775620f -r 8cdf6fb6a335 source/x265.h
--- a/source/x265.h	Tue Mar 31 20:04:28 2015 -0500
+++ b/source/x265.h	Thu Apr 02 02:03:29 2015 -0700
@@ -475,6 +475,10 @@
      uint32_t  fpsNum;
      uint32_t  fpsDenom;

+    /* Numerator and denominator of timebase */
+    uint32_t  timebaseNum;
+    uint32_t  timebaseDenom;
+
      /* Width (in pixels) of the source pictures. If this width is not an even
       * multiple of 4, the encoder will pad the pictures internally to meet this
       * minimum requirement. All valid HEVC widths are supported */



2015/3/31 8:28, Steve Borho :
> On 03/30, Xinyue Lu wrote:
>
> Variable frame rate is a problem worthy of its own patch series, not
> sure if you want to include pieces of it here. it's a rather knotty
> problem for rate-control, particularly VBV/HRD
>
 > Unless you plan to tackle real VFR support in the encoder first, I
 > recommend keeping all these variables in the OutputFile for now.
 >

Ripped VFR away. I still keep the timebase as it works together with PTS.

> the output file should perhaps indicate that it needs pts?
>

OK, and moving to future patch.


More information about the x265-devel mailing list