# Parallel 4K encode and 1080p decode

Source: [https://docs.qualcomm.com/doc/80-88500-3/topic/65_Parallel_4K_encode_and_1080p_decode.html](https://docs.qualcomm.com/doc/80-88500-3/topic/65_Parallel_4K_encode_and_1080p_decode.html)

This section describes the use case to decode and playback 1080p H.264-encoded video on an HDMI display while 4K H.264-encoded video is captured and stored in file.

The video hardware performs both encode and decode in parallel.

**Prerequisites**:
      
1. Ensure that Weston is running.
2. Record a 1080p test video for playback or push a prerecorded video.

        gst-launch-1.0 -e qtiqmmfsrc name=qmmf camera=0 ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! qtic2venc ! queue ! h264parse ! mp4mux ! queue ! filesink location=/data/output/mux1.mp4Copy to clipboard

To execute the use case, do the following:

1. To start 4K H.264 recording, run the following command in one terminal: 

        gst-launch-1.0 -e qtiqmmfsrc name=qmmf camera=0 ! video/x-raw\(memory:GBM\),format=NV12,width=3840,height=2160,framerate=30/1 ! queue ! qtic2venc ! queue ! h264parse ! mp4mux ! queue ! filesink location=/data/output/mux2.mp4Copy to clipboard

    1. The `qtiqmmfsrc` element is used to capture and encode the video
              streams.
    2. The `h264parse` and `mp4mux` elements process the
              buffers and prepare them for storage
    3. The `filesink` element stores the buffers in the file.
2. To play back the recorded 1080p video on HDMI, run the following command in another
          terminal.
    - Linux
              Ubuntu:

            export XDG_RUNTIME_DIR=/run/user/root && gst-launch-1.0 filesrc location=/data/output/mux1.mp4 ! qtdemux name=demux demux. ! queue ! h264parse ! qtic2vdec ! video/x-raw\(memory:GBM\),compression=ubwc ! waylandsink fullscreen=trueCopy to clipboard
    - Linux
              Embedded:

            export WAYLAND_DISPLAY=wayland-1 && export XDG_RUNTIME_DIR=/run/user/root && gst-launch-1.0 filesrc location=/data/output/mux1.mp4 ! qtdemux name=demux demux. ! queue ! h264parse ! qtic2vdec ! video/x-raw\(memory:GBM\),compression=ubwc ! waylandsink fullscreen=trueCopy to clipboard

**Parent Topic:** [Multimedia use cases](https://docs.qualcomm.com/doc/80-88500-3/topic/28_Multimedia_use_cases.html)

Last Published: Sep 26, 2023

[Previous Topic
Live streaming over RTSP with two H.264 streams](https://docs.qualcomm.com/bundle/publicresource/80-88500-3/topics/64_Live_streaming_over_RTSP_with_two_H264_streams.md) [Next Topic
Configure AI/ML modules](https://docs.qualcomm.com/bundle/publicresource/80-88500-3/topics/66_Configure_AI_ML_modules.md)