Class TransformationRequest.Builder

    • Method Detail

      • setFlattenForSlowMotion

        public TransformationRequest.Builder setFlattenForSlowMotion​(boolean flattenForSlowMotion)
        Sets whether the input should be flattened for media containing slow motion markers.

        The transformed output is obtained by removing the slow motion metadata and by actually slowing down the parts of the video and audio streams defined in this metadata. The default value for flattenForSlowMotion is false.

        Only Samsung Extension Format (SEF) slow motion metadata type is supported. The transformation has no effect if the input does not contain this metadata type.

        For SEF slow motion media, the following assumptions are made on the input:

        • The input container format is (unfragmented) MP4.
        • The input contains an AVC video elementary stream with temporal SVC.
        • The recording frame rate of the video is 120 or 240 fps.

        If specifying a MediaSource.Factory using Transformer.Builder.setMediaSourceFactory(MediaSource.Factory), make sure that Mp4Extractor.FLAG_READ_SEF_DATA is set on the Mp4Extractor used. Otherwise, the slow motion metadata will be ignored and the input won't be flattened.

        Using slow motion flattening together with MediaItem.ClippingConfiguration is not supported yet.

        flattenForSlowMotion - Whether to flatten for slow motion.
        This builder.
      • setScale

        public TransformationRequest.Builder setScale​(float scaleX,
                                                      float scaleY)
        Sets the x and y axis scaling factors to apply to each frame's width and height, stretching the video along these axes appropriately.

        The default value for scaleX and scaleY, 1, corresponds to not scaling along the x and y axes, respectively.

        scaleX - The multiplier by which the frame will scale horizontally, along the x-axis.
        scaleY - The multiplier by which the frame will scale vertically, along the y-axis.
        This builder.
      • setRotationDegrees

        public TransformationRequest.Builder setRotationDegrees​(float rotationDegrees)
        Sets the rotation, in degrees, counterclockwise, to apply to each frame.

        The output frame's width and height are automatically adjusted to preserve all input pixels. The rotated input frame is fitted inside an enclosing black rectangle if its edges aren't parallel to the x and y axes.

        The default value, 0, corresponds to not applying any rotation.

        rotationDegrees - The counterclockwise rotation, in degrees.
        This builder.
      • setResolution

        public TransformationRequest.Builder setResolution​(int outputHeight)
        Sets the output resolution using the output height.

        Output width of the displayed video will scale to preserve the video's aspect ratio after other transformations.

        For example, a 1920x1440 video can be scaled to 640x480 by calling setResolution(480).

        The default value, C.LENGTH_UNSET, leaves the width and height unchanged unless scaling or @linkplain #setRotationDegrees(float) rotation} are requested.

        outputHeight - The output height of the displayed video, in pixels.
        This builder.
      • setEnableRequestSdrToneMapping

        public TransformationRequest.Builder setEnableRequestSdrToneMapping​(boolean enableRequestSdrToneMapping)
        Sets whether to request tone-mapping to standard dynamic range (SDR). If enabled and supported, high dynamic range (HDR) input will be tone-mapped into an SDR opto-electrical transfer function before processing.

        The setting has no effect if the input is already in SDR, or if tone-mapping is not supported. Currently tone-mapping is only guaranteed to be supported from Android T onwards.

        enableRequestSdrToneMapping - Whether to request tone-mapping down to SDR.
        This builder.
      • experimental_setEnableHdrEditing

        public TransformationRequest.Builder experimental_setEnableHdrEditing​(boolean enableHdrEditing)
        Sets whether to attempt to process any input video stream as a high dynamic range (HDR) signal.

        This method is experimental, and will be renamed or removed in a future release. The HDR editing feature is under development and is intended for developing/testing HDR processing and encoding support. HDR editing can't be enabled at the same time as SDR tone-mapping.

        enableHdrEditing - Whether to attempt to process any input video stream as a high dynamic range (HDR) signal.
        This builder.