Update output.md

This commit is contained in:
jb-alvarado 2024-09-03 09:41:03 +02:00 committed by GitHub
parent 7e2c26fc84
commit b4ed13b06b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,6 +135,52 @@ HLS output is currently the default, mostly because it works out of the box and
The using of **-filter_complex** and *mapping* is very limited, don't use it in situations other then for splitting the outputs.
#### Activating Output
**Tee Muxer:**
To use one of the outputs you need to edit the **ffplayout.yml** config, here under **out** set your **mode** and use the different **output** options.
The tee pseudo-muxer in FFmpeg is crucial in live streaming scenarios where a single input needs to be encoded once and then broadcast to multiple outputs in different formats or protocols. This feature significantly reduces computational overhead and improves efficiency—in my tests, it achieved a 200% reduction in CPU processing expenditure—by eliminating the need for multiple FFmpeg instances or re-encoding the same input multiple times for different outputs.
**FFmpeg's Tee Pseudo-Muxer Parameter Configuration:**
The configuration of the tee pseudo-muxer in FFmpeg allows the broadcasting of a single input to multiple outputs simultaneously, each with specific settings. This is accomplished by specifying distinct formats and protocols for each output within a single command line, thus minimizing computational load by avoiding re-encoding for each target.
### Parameters and Syntax:
```shell
-c:v libx264
-crf 23
-x264-params keyint=50:min-keyint=25:scenecut=-1
-maxrate 1300k
-bufsize 2600k
-preset faster
-tune zerolatency
-profile:v Main
-level 3.1
-c:a aac
-ar 44100
-b:a 128k
-flags +cgop
-flags +global_header
-f tee
"[f=flv:onfail=ignore]rtmp://127.0.0.1:1935/798e3a9e-47b5-4cd5-8079-76a20e03fee6.stream|
[f=mpegts:onfail=ignore]udp://127.0.0.1:1234?pkt_size=1316|
[f=hls:hls_time=6:hls_list_size=600:hls_flags=append_list+delete_segments+omit_endlist:hls_segment_filename=/usr/share/ffplayout/public/live/stream-%d.ts]/usr/share/ffplayout/public/live/stream.m3u8"
```
**1. `-f tee`**: Specifies the use of the tee pseudo-muxer, which facilitates the multiplexing of the broadcast.
**2. Use of “|” (pipe)**: The pipe symbol "|" acts as a separator between the different outputs within the tee command. Each segment separated by a pipe configures a distinct output for the broadcast.
**3. Stream Processing by the Tee**:
- **First Output**: `[f=flv:onfail=ignore]rtmp://127.0.0.1:1935/798e3a9e-47b5-4cd5-8079-76a20e03fee6.stream`
- **f=flv**: Sets the output format to FLV (Flash Video).
- **onfail=ignore**: Directs FFmpeg to continue operating even if this output fails.
- **Second Output**: `[f=mpegts:onfail=ignore]udp://127.0.0.1:1234?pkt_size=1316`
- **f=mpegts**: Sets the output format to MPEG-TS (MPEG Transport Stream).
- **udp://...**: Uses the UDP protocol to send the stream with a specified packet size (`pkt_size=1316`).
- **Third Output**: `[f=hls:hls_time=6:hls_list_size=600:hls_flags=append_list+delete_segments+omit_endlist:hls_segment_filename=/usr/share/ffplayout/public/live/stream-%d.ts]/usr/share/ffplayout/public/live/stream.m3u8`
- **f=hls**: Sets the output format to HLS (HTTP Live Streaming).
Each stream is processed by the tee pseudo-muxer, which encodes the input just once, directing it to various outputs as per the specifications, thereby allowing for an efficient and less resource-intensive operation.