Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding ffmpeg re parameter

I was reading about the -re option in ffmpeg . What they have mentioned is

From the docs

-re (input)

Read input at the native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).

My doubt is basically the part of the above description that I highlighted. It is suggested to not use the option during live input streams but in the end, it is suggested to use it in real-time output.

Considering a situation where both the input and output are in rtmp format, should I use it or not?

like image 838
formatkaka Avatar asked Jan 27 '18 18:01

formatkaka


People also ask

What is re in FFmpeg?

The -re option instructs the encoder to read the source at its native frame rate. This slows the stream down to simulate live streaming and mitigates buffering and memory buildup that can disrupt playback. Note: FFmpeg is updated frequently. Download the current version and read current documentation at ffmpeg.org.

What is Probesize?

probesize integer (input) Set probing size in bytes, i.e. the size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency.

How can I watch FFmpeg?

FFmpeg can basically stream through one of two ways: It either streams to a some "other server", which re-streams for it to multiple clients, or it can stream via UDP/TCP directly to some single destination receiver, or alternatively directly to a multicast destination.

How to preserve quality of a video file using FFmpeg?

If you want to preserve the quality of your source video file, use '-qscale 0' parameter: To check list of supported formats by FFmpeg, run: 3. Converting video files to audio files To convert a video file to audio file, just specify the output format as .mp3, or .ogg, or any other audio formats.

How does FFmpeg read input files?

ffmpeg calls the libavformat library (containing demuxers) to read input files and get packets containing encoded data from them. When there are multiple input files, ffmpeg tries to keep them synchronized by tracking lowest timestamp on any active input stream.

How does FFmpeg select audio and video streams in Matroska?

out1.mkv is a Matroska container file and accepts video, audio and subtitle streams, so ffmpeg will try to select one of each type. For video, it will select stream 0 from B.mp4, which has the highest resolution among all the input video streams. For audio, it will select stream 3 from B.mp4, since it has the greatest number of channels.

What is native frame rate used for in FFmpeg?

Read input at the native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input (s) as fast as possible.


2 Answers

Don't use it. It's useful for real-time output when ffmpeg is able to process a source at a speed faster than real-time. In that scenario, ffmpeg may send output at that faster rate and the receiver may not be able to or want to buffer and queue its input.

like image 72
Gyan Avatar answered Oct 17 '22 18:10

Gyan


+What Mulvya said. It (-re) is good for streaming from offline files and reads them with it's native rate (i.e. 25 fps), where otherwise ffmpeg may output hundreds of frames per second and this may cause problem.

like image 36
the kamilz Avatar answered Oct 17 '22 18:10

the kamilz