Encoder mode: encoding without a command line
In encoder mode the encoding is described by settings: a video codec, a resolution, a bit rate, a GPU encoder, an audio codec, and so on. The FFmpeg command line is built internally, so the FFmpeg syntax never has to be written nor maintained by the application.
This is the recommended mode
The FFmpeg command-line mode is only needed when an FFmpeg option that the encoder settings do not expose is required: video filters, several outputs at once, unusual muxers, and so on.
The same settings are used from the TVideoGrabber SDK and from DirectShow; only the way they are edited differs.
From the TVideoGrabber SDK
When the package is installed, the TVideoGrabber SDK detects it automatically and offers it as the "Datastead Encoder" codec for recording, streaming, transcoding and merging. The settings are then ordinary SDK properties, set programmatically.
See Using from TVideoGrabber (encoder mode).
From a DirectShow application
A third filter is registered for this mode: Datastead Encoder, CLSID_DatasteadDirectShowEncoder = {6E990010-F426-491B-8CBE-2CA95A70B6D5}.
It has the same Video Input and Audio Input pins as the Datastead Multipurpose Encoder, but it is configured through its encoder settings instead of a command line.
| Interface | Purpose |
|---|---|
ISpecifyPropertyPages |
Returns a single property page, the encoder settings page, which edits every setting listed below. The command-line filters return two pages instead (command line and log). |
IPersistStream |
Saves and restores the whole set of settings, so that a configuration edited once can be stored by the application and applied again later. |
IDatasteadMultipurposeDirectShowEncoder and the other interfaces |
Available as on the other filters, for the version, the log, the progress information and the pin information. |
Displaying the settings page is the standard DirectShow sequence:
ISpecifyPropertyPages *pSpec = NULL;
if (SUCCEEDED (DatasteadEncoder->QueryInterface (IID_ISpecifyPropertyPages, (void**) &pSpec))) {
CAUUID pages;
if (SUCCEEDED (pSpec->GetPages (&pages))) {
IUnknown *pFilterUnk = NULL;
DatasteadEncoder->QueryInterface (IID_IUnknown, (void**) &pFilterUnk);
OleCreatePropertyFrame (hwndOwner, 0, 0, L"Datastead Encoder", 1, &pFilterUnk,
pages.cElems, pages.pElems, 0, 0, NULL);
pFilterUnk->Release();
CoTaskMemFree (pages.pElems);
}
pSpec->Release();
}
The settings can then be saved with IPersistStream::Save and restored with IPersistStream::Load, exactly as a graph editor persists a filter in a .grf file.
The encoder settings
The settings edited by the encoder settings page, and carried by IPersistStream:
Video
| Setting | Description |
|---|---|
| Video codec | Name of the video encoder, for example h264 or hevc |
| Width, height | Encoded resolution; left at 0, the resolution of the connected video pin is used |
| Bit rate (kbit/s) | Target video bit rate |
| Min bit rate, max bit rate, buffer size (kbit/s) | Rate-control settings of the encoder |
| Quality, min and max | Quality range, for the encoders that are driven by quality rather than by bit rate |
| IDR interval | Distance between two key frames, in frames |
| Max B-frames | Maximum number of consecutive B-frames |
| Thread count | Number of encoding threads |
| GPU encoder | None, Auto, Intel QSV, NVidia NVENC or AMD AMF; Auto selects the hardware encoder available on the machine, and falls back to software encoding when there is none |
| Extra parameters | Additional encoder options, for the cases that the settings above do not cover |
Audio
| Setting | Description |
|---|---|
| Audio codec | Name of the audio encoder, for example aac |
| Bit rate (kbit/s) | Target audio bit rate |
| Sample rate | 8000, 11025, 16000, 22050, 24000, 32000, 48000 or 96000 Hz |
| Bits per sample | 8 or 16 |
| Channels | 1 (mono) or 2 (stereo) |
Reset to default
The settings page also has a Reset to default button, which reloads the default settings of the encoder.
The destination of the encoding, a file path or a streaming URL, is part of the encoder configuration as well; from TVideoGrabber it is the recording or streaming destination set through the SDK.
Quick check from GraphEdit
Insert the Datastead Encoder filter, connect a video source and, if needed, an audio source, then right-click the filter to open its encoder settings page. No command line is involved. See Quick start from GraphEdit.