Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
DocumentaryTube
GStreamer

How to Preserve Video Aspect Ratio in a GStreamer YouTube Loop Stream

Use GStreamer's borders to fit the whole source into your YouTube output canvas, crop only when edge loss is acceptable, and inspect negotiated caps before streaming.

By DocumentaryTube Team 4 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To keep a looping video from looking stretched or losing its edges, scale it to the intended output canvas while preserving its display aspect ratio. In GStreamer, use videoconvertscale add-borders=true to fit the picture with borders when necessary; use cropping only if trimming the edges is acceptable. Set square-pixel output caps for YouTube and inspect the negotiated caps before streaming.

Choose whether to preserve the whole frame or fill the canvas

First decide what matters more: retaining every part of the source image or filling the output frame edge to edge. If the source and target aspect ratios differ, fitting the complete image requires unused space somewhere; filling the frame instead requires cropping or distortion. For most documentary footage, preserving the full picture with borders is safer than cutting off faces, captions, or other edge details.

Treatment What it does Trade-off
Fit with borders Scales the full image into the target canvas and adds borders when needed. Preserves the whole picture, but may leave black bars.
Crop to fill Removes excess edges to match the requested aspect ratio. Fills the canvas, but may cut off picture content.
Stretch Forces the source into the target dimensions without preserving its display geometry. Avoid it when accurate proportions matter; people and objects can look unnaturally wide or narrow.

Fit the video with GStreamer borders

videoconvertscale combines video scaling and format conversion. Its documented add-borders property is true by default, adding borders as needed to preserve display aspect ratio. A raw-video branch can use this illustrative pattern before the encoder:

... ! videoconvertscale add-borders=true ! video/x-raw,width=1280,height=720,pixel-aspect-ratio=1/1 ! ...encoder...

Replace 1280x720 with the output canvas you intend to send. That example is a branch pattern, not a complete, tested YouTube pipeline. The installed GStreamer build and downstream encoder must support the negotiated format. The GStreamer Base Plug-ins documentation describes videoconvertscale and its properties.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Match the canvas to its intended ratio

Check that the width and height express the canvas you want. For example, 1280 by 720 is 16:9. If your source has a different display ratio, fitting it within this canvas can add borders rather than distorting it. Pixel dimensions alone may not fully describe display geometry, so verify the source’s display aspect and pixel aspect information too.

Use cropping only when edge loss is acceptable

If you deliberately want a 16:9 frame filled by a 4:3 source, use a crop stage before scaling, for example:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
... ! aspectratiocrop aspect-ratio=16/9 ! videoconvertscale ! video/x-raw,width=1280,height=720,pixel-aspect-ratio=1/1 ! ...encoder...

aspectratiocrop crops to the requested ratio; it does not preserve the entire source image. Review the framing for faces, subtitles, logos, and other important details near the edges. See the GStreamer aspectratiocrop documentation.

Inspect the caps GStreamer actually negotiates

A caps filter constrains media properties negotiated downstream. Use verbose output to inspect what the pipeline produces:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
gst-launch-1.0 -v ...

Check the final raw-video caps before encoding, particularly width, height, frame rate, and pixel-aspect-ratio. YouTube recommends square pixels, expressed as pixel-aspect-ratio=1/1. The GStreamer basic concepts tutorial explains caps and verbose pipeline output. gst-launch-1.0 is useful for basic pipeline testing and debugging; for an application, GStreamer points developers to its API and gst_parse_launch().

Check YouTube Live ingest settings

YouTube’s live encoder guidance, accessed October 3, 2026, lists RTMP/RTMPS ingest, H.264, H.265, and AV1 video, and frame rates up to 60 fps. It recommends constant bitrate encoding, progressive scan, square pixels, and a two-second keyframe interval that should not exceed four seconds. For encoder setup, verify the current recommendations on YouTube’s live encoder settings page.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2Ă— USB C male to USB A female adapters and 2Ă— USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
YouTube recommendation (accessed Oct. 3, 2026) Recommended bitrate Published range
1080p at 30 fps, H.264 10 Mbps 5–14 Mbps
1080p at 30 fps, AV1 or H.265 10 Mbps 4–10 Mbps
720p at 30 fps, H.264 8 Mbps 3–8 Mbps

These are YouTube recommendations, not a guarantee of a particular viewing quality. Choose a bitrate your upload connection can sustain consistently. YouTube advises testing upload speed, testing with audio and movement similar to the real stream, and monitoring stream health during the broadcast.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the loop before the broadcast

  1. Confirm source geometry. Check the file’s actual dimensions and display geometry rather than assuming its pixel width and height tell the whole story.
  2. Set the intended output canvas. Ensure its width and height match the target ratio, such as 16:9 for 1280×720.
  3. Choose fit or crop. Preserve the complete image with add-borders=true, or deliberately crop with aspectratiocrop after checking what will be lost.
  4. Inspect negotiated caps. Run gst-launch-1.0 -v and verify the raw-video dimensions, frame rate, and square pixel aspect ratio before encoding.
  5. Test through YouTube. Use YouTube Live Control Room to check the preview and stream-health messages before relying on the loop for a real broadcast.

Troubleshoot stretching, bars, and cropping

  • The picture looks stretched: confirm the output canvas is the intended ratio and that the pipeline preserves display geometry rather than forcing incompatible dimensions.
  • Black bars appear: this is expected when the whole source is fitted into a canvas with a different aspect ratio. If edge-to-edge fill is essential, crop deliberately and inspect the result.
  • Important content is missing: a crop stage may be cutting it off. Adjust the source framing or choose borders to retain the full frame.
  • The output geometry is unexpected: inspect the final raw-video caps with gst-launch-1.0 -v, including width, height, and pixel-aspect-ratio.
  • The stream is unstable: check that the upload connection can sustain the chosen bitrate, test with representative audio and motion, and review YouTube’s stream-health messages.

GStreamer documentation describes the relevant scaling, cropping, and caps behavior, but it does not establish how every loop pipeline behaves with every GStreamer build, encoder, or source file. Test the actual combination you plan to use.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Or let it run in the cloud

If your goal is a 24/7 YouTube loop rather than building and maintaining the pipeline yourself, StreamNeo runs uploaded videos from the cloud. Upload a recording or build a playlist, add your YouTube stream key, and go live. Nothing has to stay on at home; it streams your upload as made, at any quality up to 4K 60fps for one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. Start your free StreamNeo day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.