Pipe for ffmpeg: Settings
| Line 22: | Line 22: | ||
- '''<Coding[n]>''': encoding parameters for stream n (for the stream number, only connected pins are taken into account). Stream parameters can be retrieved using IAVOPipeFFmpeg::GetPinParams(nPin, ...). Features of this section:<br> | - '''<Coding[n]>''': encoding parameters for stream n (for the stream number, only connected pins are taken into account). Stream parameters can be retrieved using IAVOPipeFFmpeg::GetPinParams(nPin, ...). Features of this section:<br> | ||
| + | |||
| + | * The codec used can be specified in the first word of this part, the codec name starts with a letter, for example: mpeg2video, mpeg4, libx264, aac, ac3, ... The codec option and stream_specifier will be automatically added before the codec name, for example for video stream 0: "-c:v:0", for audio stream 5: "-c:a:5", etc.<br> | ||
| + | * Partial options are allowed: ":stream_specifier" can be omitted after the option name, it will be automatically added for known options (see [:stream_specifier] in ffmpeg docs). If ":stream_specifier" is found after the option name, it will be changed to the actual "stream_type:additional_stream_specifier" by filter.<br> | ||
| + | Examples of <Coding>: | ||
| + | Video stream 1: "mpeg4 -b 1150k -maxrate:v 1150k" converted to "-c:v:1 mpeg4 -b:v:1 1150k -maxrate:v:1 1150k" | ||
| + | Audio stream 2: "mp2 -b:a 224k" converted to "-c:a:2 mp2 -b:a:2 224k" | ||
| + | Audio stream 0: "-codec aac -b 128K" converted to "-c:a:0 aac -b:a:0 128K" | ||
| + | <Coding[n]> sections are optional, parameters can be specified in <Common options>.<br> | ||
| + | |||
| + | - '''<Output file>''' : the full name of the output file. The file type is determined by the extension, unless changed in the <Common options> section with the "-f" option. This part is mandatory.БикЮ | ||
===Use cases=== | ===Use cases=== | ||
| Line 33: | Line 43: | ||
You can put all ffmpeg options in <Common options> and leave <Coding[N]> empty. | You can put all ffmpeg options in <Common options> and leave <Coding[N]> empty. | ||
A combination of these methods is also possible. | A combination of these methods is also possible. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revision as of 19:49, 23 October 2025
Filter interface and command line preparation for Pipe for ffmpeg DirectShow filter.
Interface IAVOPipeFFmpeg can be found in file <filter installation directory>\Idl\PipeFF.idl
Command line
The command line includes the following sections:
<Path to ffmpeg.exe> <INPUT> [<Common options>] [<Coding[0]> ... <Coding[N]>] <Output file>
where:
- <Path to ffmpeg.exe> : The full name of the ffmpeg.exe module. Specified by the user. If IAVOPipeFFmpeg::PutExe(bsExe) is called with bsExe == NULL or *bsExe = 0, ffmpeg.exe will be searched in the .exe (application) or .dll (filter) folders.
- <INPUT> : Input stream and pipe parameters. These are set by the filter based on the connection media types and predefined parameters.
- <Common options>: the following options can be specified in this section
- Input stream modifications (resize, aspect ratio, frame rate, sample rate, etc.);
- Trimming (start, end, duration, etc.);
- Encoding options (encoders, bitrate, profile, etc.);
- Additional parameters ("-y" for overwriting, "-loglevel", "-report", etc.);
NOTE: ":stream_specifier" must be set according to ffmpeg docs (-c:v, -b:a:1, etc.).
<Common options> section is optional, some parameters can be specified in the <Coding> sections.
- <Coding[n]>: encoding parameters for stream n (for the stream number, only connected pins are taken into account). Stream parameters can be retrieved using IAVOPipeFFmpeg::GetPinParams(nPin, ...). Features of this section:
- The codec used can be specified in the first word of this part, the codec name starts with a letter, for example: mpeg2video, mpeg4, libx264, aac, ac3, ... The codec option and stream_specifier will be automatically added before the codec name, for example for video stream 0: "-c:v:0", for audio stream 5: "-c:a:5", etc.
- Partial options are allowed: ":stream_specifier" can be omitted after the option name, it will be automatically added for known options (see [:stream_specifier] in ffmpeg docs). If ":stream_specifier" is found after the option name, it will be changed to the actual "stream_type:additional_stream_specifier" by filter.
Examples of <Coding>:
Video stream 1: "mpeg4 -b 1150k -maxrate:v 1150k" converted to "-c:v:1 mpeg4 -b:v:1 1150k -maxrate:v:1 1150k" Audio stream 2: "mp2 -b:a 224k" converted to "-c:a:2 mp2 -b:a:2 224k" Audio stream 0: "-codec aac -b 128K" converted to "-c:a:0 aac -b:a:0 128K"
<Coding[n]> sections are optional, parameters can be specified in <Common options>.
- <Output file> : the full name of the output file. The file type is determined by the extension, unless changed in the <Common options> section with the "-f" option. This part is mandatory.БикЮ
Use cases
To create the ffmpeg command line, the IAVOPipeFFmpeg interface functions are used (see Idl\PipeFF.idl). There are two main methods for using these functions to create a command line: 1. For users unfamiliar with ffmpeg syntax and for quick usage:
<Common options> is used for actual "common" properties: "-y", "-loglevel", "-report", etc. <Coding[N]> is used to select the encoder. You can also set the bitrate and other parameters.
2. For advanced ffmpeg users
You can put all ffmpeg options in <Common options> and leave <Coding[N]> empty.
A combination of these methods is also possible.