Go2rtc is an open-source streaming proxy designed to simplify real-time camera integration into platforms like Home Assistant. At its core, it is capable of processing, multiplexing, and even transcoding video and audio streams across multiple protocols. By handling protocol conversion and optional codec transformation, Go2rtc enables efficient media delivery to a wide range of clients and platforms.
Stream transcoding refers to the process of converting a video or audio stream from one format or codec to another. In real-time applications like smart home monitoring, surveillance systems, and IP camera streaming, transcoding is often essential to ensure compatibility, reduce bandwidth usage, or improve latency performance. Transcoding allows devices that use different media protocols to communicate effectively, a major advantage in fragmented IoT environments.
Role of Go2rtc in Handling Multimedia Streams
Go2rtc serves as a multiprotocol stream bridge. It is commonly deployed as a backend component within smart home systems, particularly those that need to unify streaming formats from a variety of IP cameras and doorbells. Supporting protocols such as RTSP, WebRTC, HLS, and SRT, it creates interoperability between video producers (e.g., IP cameras) and consumers (e.g., Home Assistant dashboards, mobile clients, and NVR software).
Go2rtc can act as a pass-through proxy when the stream format is already compatible with the target protocol. However, when compatibility is lacking, transcoding becomes necessary. This is particularly important in cases where cameras use proprietary formats, or when delivering media to browsers that only support specific codecs like H.264 or AAC.
Transcoding Features Available in Go2rtc
Built-in transcoding functionality in Go2rtc is powered by FFmpeg, a robust and widely used multimedia framework. Through FFmpeg integration, Go2rtc can perform on-the-fly transcoding of both video and audio components in a live stream. Whether converting video from H.265 to H.264 or audio from G.711 to AAC, Go2rtc offers flexibility for environments with diverse media format requirements.
Transcoding is not always enabled by default. The Go2rtc configuration must explicitly specify when a stream requires decoding and re-encoding. This ensures that unnecessary CPU resources are not consumed when simple container or protocol conversion suffices. It also allows users to optimize stream performance and avoid latency that could arise from full transcoding operations.
Codecs Supported for Input and Output
When Go2rtc is used for transcoding, the supported input and output codecs are dictated largely by the capabilities of FFmpeg and the hardware environment. Common input codecs typically include H.264, H.265 (HEVC), AAC, G.711 (µ-law and A-law), Opus, and MP3. These codecs are supported by most IP cameras and video doorbells.
Output codec support covers the needs of modern clients such as web browsers and mobile devices. Go2rtc can transcode video streams to H.264 and audio streams to AAC or Opus. These codecs are universally supported in WebRTC and HTML5 video contexts, ensuring high compatibility. Go2rtc’s support for codec multiplexing also allows mixed streams (e.g., H.264 video with AAC audio) to be packaged into suitable containers like MP4 or WebM.
Scenarios That Require Transcoding in Go2rtc
Several use cases make transcoding a necessity in real-world deployments. A common scenario is an H.265 stream from a modern IP camera needing conversion to H.264 for browser compatibility. Many browsers do not support H.265 natively due to licensing restrictions, making transcoding mandatory for WebRTC or MSE playback.
Another situation involves audio formats. While G.711 is standard in SIP and some low-cost cameras, it is not compatible with WebRTC. Transcoding the audio to AAC or Opus is essential to ensure smooth playback in web clients. In environments with bandwidth constraints, transcoding can also help reduce stream resolution or bitrate dynamically.
Configuration Syntax for Transcoding Setup
Transcoding with Go2rtc requires careful configuration using the go2rtc.yaml file. Stream sources are defined under the streams: section. Each stream entry can include ffmpeg: options that invoke decoding and encoding settings.
streams:
front_door:
- ffmpeg:rtsp://user:[email protected]:554/stream1#video=h264#audio=aac
This configuration instructs Go2rtc to fetch an RTSP stream and transcode the video to H.264 and audio to AAC. Go2rtc will invoke FFmpeg with the appropriate flags in the background, managing stream processing in real time.
Transcoding options may also specify resolution downscaling, bitrate limits, or container formats. These additional flags are useful for mobile optimization or limited bandwidth scenarios. Proper hardware acceleration configuration can further improve performance and reduce CPU usage.
Hardware Acceleration Support for Transcoding
Transcoding can be CPU-intensive, especially for high-definition streams or multiple concurrent channels. Go2rtc, when compiled with appropriate FFmpeg options, can leverage hardware acceleration through APIs such as VAAPI (Intel), NVENC (NVIDIA), or VideoToolbox (Apple). This allows for real-time encoding with minimal system load.
Hardware acceleration settings must be explicitly defined in the Go2rtc or FFmpeg command-line parameters. For instance, using VAAPI might require flags like -hwaccel vaapi -vaapi_device /dev/dri/renderD128. On platforms like Raspberry Pi, transcoding performance is limited by available GPU support, so fallback to software encoding is often necessary.
Using hardware acceleration makes it feasible to transcode multiple 1080p or even 4K streams on consumer-grade systems. This is especially beneficial for NVR setups with live preview and recording requirements across multiple display resolutions.
Limitations of Go2rtc Transcoding Functionality
While Go2rtc offers robust transcoding capabilities, certain limitations must be acknowledged. Transcoding adds latency to live streams, which can be problematic for time-sensitive applications like intercom systems or live camera feeds. Buffering and frame dropping may occur if system resources are insufficient or if network jitter affects input stream quality.
Not all codecs are supported uniformly across platforms. For instance, H.265 decoding may not be available in older FFmpeg builds or may lack GPU acceleration. Similarly, AAC encoding requires a properly licensed FFmpeg build. Licensing and platform constraints can limit the availability of certain codecs depending on the system environment.
Dynamic codec switching during playback is not fully supported, which means transcoding settings must be defined per stream and cannot change based on client capabilities in real time. This places a greater responsibility on the administrator to predefine compatible output settings.
Performance Optimization Tips for Transcoding
Maximizing performance while using transcoding in Go2rtc involves balancing system capacity and stream demands. Using hardware acceleration where available is the most significant step in reducing CPU load. Setting lower output resolutions or bitrates can also help maintain real-time performance without affecting visual clarity too much.
Monitoring tools like htop, ffmpeg logs, or Home Assistant performance stats can help identify bottlenecks. If CPU usage spikes significantly during multiple stream processing, administrators may consider offloading streams to a dedicated media server or reducing frame rate for non-critical feeds.
Incorporating pre-transcoded streams (if supported by the camera) can also bypass transcoding altogether. Some modern IP cameras offer multiple stream profiles (e.g., main stream at 4K and sub stream at 720p). Using the sub-stream for real-time WebRTC playback and reserving the main stream for recording can optimize resource allocation.
Compatibility Across Browsers and Devices
Browser support for various codecs is a major consideration when enabling transcoding. Most Chromium-based browsers support H.264 and AAC, making these the ideal output codecs for Go2rtc. Safari on macOS and iOS also supports these codecs natively. Using Opus as an alternative audio codec increases compatibility with conferencing tools and some mobile apps.
For embedding camera feeds into dashboards or mobile interfaces, ensuring that the output format is HTML5-friendly is essential. Go2rtc can deliver H.264/AAC via WebRTC or MSE/MP4 containers, making integration seamless with Home Assistant’s picture-entity or webrtc-camera cards.
Testing across multiple client types—browsers, apps, smart displays—is recommended to confirm compatibility. Some Android-based panels may require specific container formats or bitrates to function optimally, further emphasizing the importance of configurable transcoding settings.
Security and Stream Protection During Transcoding
Transcoding introduces additional opportunities for unauthorized access if the streams are not protected. Go2rtc supports secure stream access using tokens or reverse proxy layers like NGINX or Caddy with HTTPS. Protecting both the source and output streams from unauthorized use is critical, especially when cameras monitor sensitive areas.
Authentication credentials should be stored securely and not exposed in public dashboard configurations. Transcoded streams should be limited in availability using ACL rules or session-based keys. Streaming endpoints exposed to the internet must use SSL encryption and, where possible, two-factor authentication.
Regular updates to Go2rtc and its underlying FFmpeg libraries ensure patched vulnerabilities and improved codec support. Security audits of exposed services and logs should be performed periodically.
Future Prospects for Codec and Transcoding Support
The development pace of Go2rtc is consistent, with active contributions improving protocol support and codec compatibility. Future versions are expected to support better adaptive bitrate streaming, more codec profiles, and smarter transcoding pipelines. These enhancements will further cement Go2rtc as a core component in home and enterprise-level surveillance setups.
With growing support for AV1 and other next-generation codecs, Go2rtc may eventually enable real-time transcoding to ultra-efficient formats, enabling high-quality video delivery at significantly reduced bandwidth. Improved AI-based transcoding decisions, like scene-aware bitrate control, may also become possible through plugin integrations.
Conclusion
Go2rtc enables real-time stream transcoding using FFmpeg and supports a wide range of input and output codecs. With proper configuration, it can deliver browser-compatible streams even when original formats are incompatible. It supports H.264, H.265, AAC, Opus, and G.711, offering flexibility for integration across diverse client environments.
Transcoding is powerful but requires system resources. Performance optimization through hardware acceleration, stream profiling, and bandwidth planning is essential for smooth operation. Limitations in real-time dynamic switching and codec licensing should be considered when planning deployments.
Go2rtc provides a modern, modular approach to stream handling in smart environments, bridging the gap between fragmented camera ecosystems and unified dashboards like Home Assistant.


