User:Joger/FFmpeg
FFProbe
FFProbe is used to inspect media, for example to view format or stream information. You can use the following command line to view a file's format and stream information. It will print out information about the file's streams, such as video and audio streams, as well as the container format.
ffprobe -v error -show_streams -show_format -print_format json <name_of_media>
Useful options
- -v error suppresses FFprobe's header and decoding information, so we only see the interesting output information.
- -print_format json makes the output easier to read.
- -select_streams v will only print video streams. It can be replaced by a to show only audio streams or s to show only subtitle streams.
FFMpeg
Low latency streaming
> mediamtx > ffmpeg -filter_complex ddagrab=video_size=1024x890:output_idx=0:framerate=60,hwdownload,format=bgra -fflags nobuffer -vcodec libx264 -tune zerolatency -f rtsp rtsp://127.0.0.1:8554/webcam.h264 > ffplay rtsp://127.0.0.1:8554/webcam.h264 -fflags nobuffer -flags low_delay -framedrop
Streaming protocols
RTMP
The Real-Time Messaging Protocol (RTMP), a TCP-based protocol renowned for its low latency, was created by Macromedia/Adobe for use with Adobe Flash. Although it was popular until recently, it has not been updated to support new codecs. Traditionally, RTMP was utilized for both the ingestion and distribution of streaming media, but its use has been on the decline. It necessitates an additional browser plugin and an RTMP server. Despite the discontinuation of Flash support, RTMP remains widely used due to its low latency and is still the standard for creating streamed content on platforms like YouTube and Facebook Live.
HTTP
TCP-based streaming offers the broadest reach and is unlikely to be blocked in any location. It eliminates the need for a separate streaming server or browser plugin, thanks to HTML5 video support. Media Source Extensions (MSE) allow browsers to play HLS and MPEG-DASH, commonly used in JavaScript players. While HTTP is the standard on the distribution side for major streaming platforms, it is less common on the ingestion side due to its higher latency compared to RTMP, making it less favored for high-quality content ingestion.
SRT
Secure Reliable Transport (SRT) is a UDP-based protocol that operates without an initial handshake. It is recognized for its low latency and is faster than RTMP. Although it relies on UDP, SRT ensures reliable streaming through its error correction mechanisms. SRT is seldom used on the distribution end as it lacks browser support. However, its popularity is growing on the ingest side due to its low latency, positioning it as a potential replacement for RTMP ingest.