# Video transcoding

Source: [https://docs.qualcomm.com/doc/80-70022-50/topic/gst-video-transcode-example.html](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-video-transcode-example.html)

The **gst-video-transcode-example** application supports video transcoding of
        AVC-to-HEVC or HEVC-to-AVC format. A few use cases can be video editing, security camera,
        and augmented reality.

The following figure shows the pipeline, which reads the incoming stream, decodes and
            encodes it, and either displays the transcoded output on a screen, or saves it to a
            file. For information about the plugins used in this pipeline, see [Pipeline flow](https://docs.qualcomm.com/doc/80-70022-50/topic/gst-video-transcode-example.html#gst-video-transcode-example__section_rdl_ysg_4bc).

Figure : gst-video-transcode-example pipeline 
            
            <?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" width="1050" height="140" viewbox="0 0 1050 140">
  <g>
    <rect x=".5" y=".499877929686591" width="1049" height="139" rx="7.499999999999996" ry="7.499999999999996" style="fill: #fafafa;"></rect>
    <path d="M1042,1c3.85986328125,0,7,3.14013671875,7,7v124c0,3.85986328125-3.14013671875,7-7,7H8c-3.85986328125,0-7-3.14013671875-7-7V8c0-3.85986328125,3.14013671875-7,7-7h1034M1042,0H8C3.581733703613281,0,0,3.581733703612372,0,8v124c0,4.418273925780341,3.581733703613281,8,8,8h1034c4.41845703125,0,8-3.581726074219659,8-8V8c0-4.418266296387628-3.58154296875-8-8-8h0Z" style="fill: #d2d7e1;"></path>
  </g>
  <g>
    <g>
      <rect x="15" y="23.737420641774406" width="100" height="56.666700000001583" rx="4" ry="4" style="fill: #007884;"></rect>
      <text transform="translate(43.082027435302734 56.746383666991278)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">filesrc</tspan></text>
      <rect x="255" y="23.737437308442168" width="120" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
      <rect x="135" y="23.737437308442168" width="100" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
      <g>
        <line x1="235" y1="52.070770263670966" x2="249.976654052734375" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="248.955352783203125 55.561203002928778 255 52.070770263670966 248.955352783203125 48.580337524413153 248.955352783203125 55.561203002928778"></polygon>
      </g>
      <g>
        <line x1="115" y1="52.070770263670966" x2="129.976638793945312" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="128.955352783203125 55.561203002928778 135 52.070770263670966 128.955352783203125 48.580337524413153 128.955352783203125 55.561203002928778"></polygon>
      </g>
      <text transform="translate(273.910125732421875 47.146926879881903)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">h264parse/</tspan><tspan x="3.296875" y="19.2001953125">h265parse</tspan></text>
      <g>
        <line x1="375" y1="52.070770263670966" x2="389.976654052734375" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="388.955352783203125 55.561203002928778 395 52.070770263670966 388.955352783203125 48.580337524413153 388.955352783203125 55.561203002928778"></polygon>
      </g>
      <g>
        <rect x="395" y="23.737437308442168" width="120" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
        <text transform="translate(410.574188232421875 47.146926879881903)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">vl2h264dec/</tspan><tspan x="3.296875" y="19.2001953125">v4l2h65dec</tspan></text>
      </g>
      <g>
        <line x1="515" y1="52.070770263670966" x2="529.97662353515625" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="528.955322265625 55.561203002928778 535 52.070770263670966 528.955322265625 48.580337524413153 528.955322265625 55.561203002928778"></polygon>
      </g>
      <g>
        <line x1="655" y1="52.070770263670966" x2="669.97662353515625" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="668.955322265625 55.561203002928778 675 52.070770263670966 668.955322265625 48.580337524413153 668.955322265625 55.561203002928778"></polygon>
      </g>
      <g>
        <line x1="795" y1="52.070770263670966" x2="809.97662353515625" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="808.955322265625 55.561203002928778 815 52.070770263670966 808.955322265625 48.580337524413153 808.955322265625 55.561203002928778"></polygon>
      </g>
      <g>
        <line x1="915" y1="52.070770263670966" x2="929.976623535159888" y2="52.070770263670966" style="fill: none; stroke: #000; stroke-miterlimit: 10;"></line>
        <polygon points="928.955322265630457 55.561203002928778 935 52.070770263670966 928.955322265630457 48.580337524413153 928.955322265630457 55.561203002928778"></polygon>
      </g>
      <g>
        <rect x="535" y="23.737437308442168" width="120" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
        <text transform="translate(546.179659843444824 47.146133422850653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">v4l2h265enc/</tspan><tspan x="7.7890625" y="19.2001953125">v4l2h64enc</tspan></text>
      </g>
      <rect x="675" y="23.737437308442168" width="120" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
      <text transform="translate(693.91015625 47.146926879881903)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">h265parse/</tspan><tspan x="3.296875" y="19.2001953125">h264parse</tspan></text>
      <g>
        <rect x="815" y="23.737437308442168" width="100" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
        <text transform="translate(833.62109375 56.746231079100653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">mp4mux</tspan></text>
      </g>
      <rect x="935" y="23.737437308442168" width="100" height="56.66666666666697" rx="4" ry="4" style="fill: #007884;"></rect>
      <text transform="translate(959.56640625 56.746231079100653)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">filesink</tspan></text>
      <text transform="translate(153.703125 56.746276855467841)" style="fill: #fff; font-family: Roboto-Regular, Roboto; font-size: 16px;"><tspan x="0" y="0">qtdemux</tspan></text>
    </g>
    <g>
      <text transform="translate(956.50946044921875 112.354095458983466)" style="font-family: Roboto-Regular, Roboto; font-size: 14px;"><tspan x="0" y="0">Open source</tspan></text>
      <rect x="936.258425142610577" y="100.262594617012837" width="16" height="16" rx="2" ry="2" style="fill: #007884;"></rect>
    </g>
  </g>
</svg>

## Run the application

The following table lists the actions that can be performed for the common use
                    cases of gst-video-transcode-example application:| Use case | Actions |
| --- | --- |
| Video editing | Rotate, flip, or resize videos. |
| Security camera | Invert or rotate the video image to compensate for situations<br>                                where the camera is improperly mounted. |
| Augmented reality | Scale or rotate the video feed to synchronize with the virtual<br>                                components. |

To run the transcoding use cases, do the following:

1. Ensure that you complete the [Prerequisites](https://docs.qualcomm.com/doc/80-70022-50/topic/mm_sample_apps_prerequisites.html).
2. Input `AVC.mp4` and `HEVC.mp4` video files on the
                    target device.
3. In the terminal of the target device, transcode the video
                        file:

        gst-video-transcode-example -i /etc/media/<input-file>.mp4 -c <format> -o /etc/media/<output-file>.mp4    Copy to clipboard

The following table provides a description of the command-line
                            parameters:    | Command-line parameter | Description |
    | --- | --- |
    | `-1` | Specifies the absolute path to the MP4 input<br>                                        file. |
    | `-c` | Specifies the video codec of the *input*file.<ul class="ul" id="gst-video-transcode-example__ul_wrj_d5g_4bc"><br>                                            <li class="li"><code class="ph codeph">1</code> = AVC (H.264)</li><br><br>                                            <li class="li"><code class="ph codeph">2</code> = HEVC (H.265)</li><br><br>                                        </ul> |
    | `-o` | Specifies the absolute path to where the transcoded MP4<br>                                        file is saved. |
4. Run the use cases for different video formats:
    - Transcode from AVC to
                            HEVC:

            gst-video-transcode-example -i /etc/media/<avc>.mp4 -c 1 -o /etc/media/<hevc>.mp4Copy to clipboard
    - Transcode from HEVC to
                            AVC:

            gst-video-transcode-example -i /etc/media/<hevc>.mp4 -c 2 -o /etc/media/<avc>.mp4Copy to clipboard
5. To stop the use case, use CTRL +
                    C.
6. In the terminal of the target device, run the following command in the SSH shell
                    to display the available help
                    options:

        gst-video-transcode-example --helpCopy to clipboard

## Expected output

The video stream is transcoded from H.264 to H.265 and back again to the H.264
                format.

## Pipeline flow

The following table lists the plugins used in the video transcoding pipeline: | Plugin | Description |
| --- | --- |
| filesrc | Reads the video streams. |
| qtdemux | Demultiplexes the streams into separate audio and video<br>                                streams. |
| h264parse | Parses the H.264 video stream. |
| h265parse | Parses the H.265 video stream. |
| [v4l2h264dec](https://docs.qualcomm.com/doc/80-70022-50/topic/v4l2h264dec.html) | Decodes the H.264 video stream using Video4Linux. |
| [v4l2h265dec](https://docs.qualcomm.com/doc/80-70022-50/topic/v4l2h265dec.html) | Decodes the H.265 video stream using Video4Linux. |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50/topic/waylandsink.html) | Displays the H.264 video stream on Wayland display. |
| filesink | Writes the H.265 video to a YUV file for playback. |

The following table provides information on how the decoded video streams
                        are handled to generate the transcoded output:| Video format | Description |
| --- | --- |
| H.264 | <ol class="ol" id="gst-video-transcode-example__ol_nk2_bwh_4bc"><br>                                        <li class="li"><a href="https://docs.qualcomm.com/doc/80-70022-50/topic/v4l2h265enc.html">v4l2h265enc</a> encodes the decoded<br>                                            H.264 video into H.265 format.</li><br><br>                                        <li class="li">h265parse parses the H.265 video stream.</li><br><br>                                        <li class="li">mp4mux multiplexes the stream into an MP4<br>                                            container.</li><br><br>                                        <li class="li">filesink writes the stream data to a file.</li><br><br>                                    </ol><br><br>                                    <br>The AVC (H.264) video is transcoded to HEVC (H.265)<br>                                        format. |
| H.265 | <ol class="ol" id="gst-video-transcode-example__ol_zfg_fwh_4bc"><br>                                        <li class="li"><a href="https://docs.qualcomm.com/doc/80-70022-50/topic/v4l2h264enc.html">v4l2h264enc</a> encodes the decoded<br>                                            H.265 video into H.264 format.</li><br><br>                                        <li class="li">h264parse parses the H.264 video stream.</li><br><br>                                        <li class="li">mp4mux multiplexes the stream into an MP4<br>                                            container.</li><br><br>                                        <li class="li">filesink writes the stream data to a file.</li><br><br>                                    </ol><br><br>                                    <br>The HEVC (H.265) video is transcoded to AVC (H.264)<br>                                        format. |

## Related information

[Transform and Transcode use cases](https://docs.qualcomm.com/doc/80-70022-50/topic/transform-and-transcode-use-cases.html)

**Parent Topic:** [Run sample applications for video and audio](https://docs.qualcomm.com/doc/80-70022-50/topic/audio-sample-applications.html)

Last Published: Feb 20, 2026

[Previous Topic
Audio-video playback](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/gst-audio-video-playback.md) [Next Topic
Video playback](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/gst-video-playback-example.md)