What is the ffmpeg command -re/-fpre/-codec:v?

Asked 2 years ago, Updated 2 years ago, 121 views

It's just a question as per the title, but with the ffmpeg command,

ffmpeg-itest.mp4-threads2-codec:v libx264-s:v1280x720-aspect:v16:9-b:v256k-re-fpre:v libx264-hls.ffpreset-codec:alibfaac-ar:a44100-b:a128k-ac:a2-map0-f segment-segment_segment_segment-time.

I checked the meaning of this option because of the command, but I didn't understand a few things, and there was an error when I ran it, so please let me know the solution.

First of all, regarding the options, I really didn't understand -re and -fpre, so please let me know.Also, ffmpeg options include codec and vcodec, but there was no codec:v, so please let me know why.

Next is the error, but if you try this,

Option re(read input at native frame rate) cannot be applied to output file streamfiles/stream%03d.ts

It says that you are trying to apply the input options to the output file or vice versa, but I don't understand the meaning...
Is the usage wrong?
When you run it, you do it in the streamfiles directory where test.mp4 is located.

ffmpeg

2022-09-30 19:23

2 Answers

See the FFmpeg official document for information on the behavior of the various options.

5.5 Video Options
-vcodec codec (output)
Set the video codec.This is an alias for -codec:v.

-codec:v is the original option name for the video codec, and -vcodec is the alias (also known as

5.11 Advanced options
-re (input)
Read input at 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).

The -re option instructs you to load files at the original (native) frame rate speed.

Unlike live sources such as cameras, file input can generate data faster than real time if encoding is fast enough.For example, in the case of 30 fps materials, if you can process 60 frames per second, you can eventually process it in 1/2 of the content ratio.This behavior is desirable because it can reduce processing time during file-to-file conversion, but the problem arises that streaming output results in x2 fast-forward playback.This option exists to avoid this behavior.

5.12.1 ffpreset files
ffpreset files are specified with the vpre, apre, spre, and fpreoptions.The fpreoption takes the filename of the preset installed of a preset name as expected...

The -fpre option specifies a プリpreset file 」 that describes the codec parameter settings.

The next error is that if you try to do this, you can't be applied to output file streamfiles/stream%03d.ts

This is just a guess, but I think it's useless to add the -re option to HLS (HTTP Live Streaming).

HLS motion picture distribution does not push data from the server to the client, but rather PULL delivery from the client to the server.In other words, there is no need to reduce the encoding speed of HLS content to the original frame rate (if it can be processed quickly, encode it).


2022-09-30 19:23

The -re option reads the input data at the frame rate (synchronizes the input and output frame rates).
If you add the -fpre option, you can read the external preset (configuration) file.
-codec:v can be a video codec.- You can think of it as something similar to vcodec.

As for the cause of the error, I do not know the contents of the preset file, so I guess
If -re is added, it will be converted at a fixed frame rate.
Is the quality fixed (-crf option, etc.) in the preset file?
In the case of quality fixing mode such as h264, the frame rate becomes variable and cannot be fixed.
Remove -re and try.


2022-09-30 19:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.