# Picture-in-picture: 1080p camera preview and 1080p recorded H.264 video file playback

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

The following image shows a 1080p live preview from the camera with 1080p recorded video
      playback in the 640 × 360 destination window in the bottom-right corner. 
![](NoFileFound_PiP%E2%80%931080p_camera_preview_and_1080p_recorded_h264_video_file_playback.png)

1. To execute this use case, run the following command.
    - Linux
            Ubuntu:

            export XDG_RUNTIME_DIR=/run/user/root && gst-launch-1.0 qtiqmmfsrc name=qmmf ! video/x-raw\(memory:GBM\),width=1920,height=1080 ! qtivcomposer name=mix sink_0::position="<0, 0>" sink_0::dimensions="<1920,1080>" sink_1::position="<1280, 720>" sink_1::dimensions="<640, 360>" mix. ! video/x-raw\(memory:GBM\),format=NV12 ! queue ! waylandsink sync=false fullscreen=true filesrc location=/data/output/mux.mp4 ! qtdemux ! h264parse ! qtic2vdec ! mixCopy to clipboard
    - Linux
            Embedded:

            export WAYLAND_DISPLAY=wayland-1 && export XDG_RUNTIME_DIR=/run/user/root && gst-launch-1.0 qtiqmmfsrc name=qmmf ! video/x-raw\(memory:GBM\),width=1920,height=1080 ! qtivcomposer name=mix sink_0::position="<0, 0>" sink_0::dimensions="<1920,1080>" sink_1::position="<1280, 720>" sink_1::dimensions="<640, 360>" mix. ! video/x-raw\(memory:GBM\),format=NV12 ! queue ! waylandsink sync=false fullscreen=true filesrc location=/data/output/mux.mp4 ! qtdemux ! h264parse ! qtic2vdec ! mixCopy to clipboard
2. The `qtiqmmfsrc` element captures the 1080p resolution stream from the camera and passes it to the `qtivcomposer` element.
3. The other 1080p stream is read from the stored file by the `filesrc` element and passed to the `qtivcomposer` element.
4. The `qtivcomposer` element downscales the stream from camera to 640 x 480 and composes it on top of the buffer obtained from `filesrc`. The composed buffer is then passed to `waylandsink`.
5. The `waylandsink` element renders the composed buffer on the display.

**Parent Topic:** Video composition use case

Last Published: Sep 26, 2023

Previous Topic
 
Video composition use case Next Topic

Video tiling: Multiple video streams tiled in one output