FFmpeg - Output Network Stream: Difference between revisions
mNo edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:FFmpeg]] | [[Category:FFmpeg]] | ||
[[Category:Streaming]] | [[Category:Streaming]] | ||
All | This article provides a practical reference for using FFmpeg to output a continuous network stream to common streaming protocols. | ||
All examples assume: | |||
* MPEG Transport Stream (MPEG-TS) container | |||
* AVC (H.264) video | |||
* AAC audio | |||
* Continuous looping (`-stream_loop -1`) | |||
* Real-time pacing (`-re`) | |||
* Direct passthrough of codecs (`-c copy`) | |||
== Overview == | |||
FFmpeg can output live network streams to protocols such as RTMP, RTSP, SRT, and IceCast. | |||
== RTMP == | == RTMP == | ||
<code>ffmpeg -re -stream_loop -1 -i <input.file> -c copy -flush_packets 0 -f flv rtmp://<destination.address>:1935/<output.file></code> | <code> | ||
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -flush_packets 0 -f flv rtmp://<destination.address>:1935/<output.file> | |||
</code> | |||
== RTSP == | == RTSP == | ||
<code>ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f rtsp rtsp://<destination.address>:554/<output.file></code> | <code> | ||
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f rtsp rtsp://<destination.address>:554/<output.file> | |||
</code> | |||
== SRT == | == SRT == | ||
<code>ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts 'srt://<destination.address>:8890/<output.file>?streamid=publish:big_buck_bunny_480p_h264_stereo_aac&pkt_size=1316'</code> | <code> | ||
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts 'srt://<destination.address>:8890/<output.file>?streamid=publish:big_buck_bunny_480p_h264_stereo_aac&pkt_size=1316' | |||
</code> | |||
== IceCast == | == IceCast == | ||
<code>ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts -content_type 'video/mp4' icecast://<username>:<password>@<destination.address>:8000/<output.file></code> | <code> | ||
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts -content_type 'video/mp4' icecast://<username>:<password>@<destination.address>:8000/<output.file> | |||
</code> | |||
== References == | == References == | ||
[[ | * [[Streaming Media]] | ||
* FFmpeg Documentation – https://ffmpeg.org/documentation.html | |||
== Further Reading == | == Further Reading == | ||
[[FFmpeg - IceCast Metadata]] | * [[FFmpeg - IceCast Metadata]] | ||
Latest revision as of 13:51, 14 March 2026
This article provides a practical reference for using FFmpeg to output a continuous network stream to common streaming protocols. All examples assume:
- MPEG Transport Stream (MPEG-TS) container
- AVC (H.264) video
- AAC audio
- Continuous looping (`-stream_loop -1`)
- Real-time pacing (`-re`)
- Direct passthrough of codecs (`-c copy`)
Overview
FFmpeg can output live network streams to protocols such as RTMP, RTSP, SRT, and IceCast.
RTMP
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -flush_packets 0 -f flv rtmp://<destination.address>:1935/<output.file>
RTSP
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f rtsp rtsp://<destination.address>:554/<output.file>
SRT
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts 'srt://<destination.address>:8890/<output.file>?streamid=publish:big_buck_bunny_480p_h264_stereo_aac&pkt_size=1316'
IceCast
ffmpeg -re -stream_loop -1 -i <input.file> -c copy -f mpegts -content_type 'video/mp4' icecast://<username>:<password>@<destination.address>:8000/<output.file>
References
- Streaming Media
- FFmpeg Documentation – https://ffmpeg.org/documentation.html