Skip to content

media sdk g64 converters

Andre Lafleur edited this page Jul 15, 2026 · 6 revisions

About G64 converters

The G64 converters transform an existing G64 or G64x file into another supported output: ASF, MP4, or a password-protected G64x. All converters inherit from G64ConverterBase and share the same lifecycle.

Converter Output Use it for
G64ToAsfConverter ASF Sharing recordings with consumers that require ASF, with optional burned-in date/time and camera name.
G64ToMp4Converter MP4 Producing review copies for general-purpose video tools.
G64xPasswordProtectionConverter Password-protected G64x Restricting access to a G64x package without changing the package format.

Converters operate on local files. To produce the input G64/G64x in the first place, use MediaExporter.

How conversion works

Every converter follows the same five steps:

  1. Construct the converter.
  2. Subscribe to ConversionFinished and, if the UI needs progress, ProgressChanged.
  3. Call Initialize with the input path, output path, and format-specific options.
  4. await ConvertAsync().
  5. Read the result from the ConversionFinishedEventArgs carried by the ConversionFinished event.

The converter implements IDisposable. Dispose it after the conversion completes.

ConvertAsync returns a non-generic Task. Awaiting it tells you the conversion finished, but it does not return the result. The result reaches your code through ConversionFinished.

A converter runs one conversion per Initialize call. To run another conversion with the same converter instance, call Initialize again before calling ConvertAsync, or construct a new converter.

ProgressChanged reports conversion progress. The handler receives a System.ComponentModel.ProgressChangedEventArgs; read its ProgressPercentage for a value from 0 to 100.

Initialize overloads

ASF and MP4 conversion both have overloads with and without an Engine.

Converter Overload Use it when
G64ToAsfConverter Initialize(string filePath, bool displayDateTime, bool writeCameraName, bool exportAudio, string outputFilePath, Guid profileId) The conversion is local and the input does not require Security Center privileges to remove encryption.
G64ToAsfConverter Initialize(IEngine engine, string filePath, bool displayDateTime, bool writeCameraName, bool exportAudio, string outputFilePath, Guid profileId) The converter must validate Security Center privileges, including removal of encrypted video.
G64ToMp4Converter Initialize(string filePath, bool exportAudio, string outputFilePath) The conversion is local and the input does not require Security Center privileges to remove encryption.
G64ToMp4Converter Initialize(IEngine engine, string filePath, bool exportAudio, string outputFilePath) The converter must validate Security Center privileges, including removal of encrypted video.
G64xPasswordProtectionConverter Initialize(string filePath, string outputFilePath, string password) The output must remain G64x and be protected by a password.

All Initialize methods validate that filePath, outputFilePath, and, for password protection, password are not null or empty. They also confirm that the input file exists before the conversion starts. Pass outputFilePath with a directory and file name; do not pass only a file name.

For ASF and MP4 conversion, passing an Engine affects encrypted video handling. During initialization, the converter checks the logged-on user's ConvertExportedFiles privilege. It allows encrypted video to be converted to an unencrypted output only when the engine is logged on and the user has the RemoveEncryption privilege.

ConversionFinishedEventArgs

The ConversionFinished event carries a ConversionFinishedEventArgs:

Property Type Description
Result ConversionResult Outcome enum.
Filenames List<string> Paths of the output files produced. Empty when no output is kept.
ErrorMessage string Error description or partial-success warnings when available.
ExceptionDetails Exception Exception raised during conversion, if any.

Branch on Result before using Filenames.

Conversion results

ConversionResult contains these values:

Value Meaning
Unknown The conversion result is undefined.
Successful The conversion completed and produced usable output.
Cancelled The conversion was cancelled.
NoVideoAvailable No convertible video was available in the requested input or range.
FileNotFound The input file could not be found.
EncryptedFile The input contained encrypted video and the conversion could not remove encryption.
CodecNotSupported The requested output cannot be produced from the input codec.
ErrorOccured An unexpected conversion error occurred. Note the spelling: ErrorOccured (one r), not ErrorOccurred.
PartiallySuccessful Some sequences were converted and some were skipped or degraded. Inspect Filenames and ErrorMessage.

PartiallySuccessful is a usable-output result. Treat it differently from Successful only if the application must reject outputs with skipped encrypted sequences, removed overlays, removed audio, or frame-format warnings.

Encrypted input files

ASF and MP4 outputs are unencrypted. The ASF and MP4 converters do not accept a password parameter.

For Security Center encrypted video, use an Initialize overload that takes an Engine. The engine must be logged on as a user with RemoveEncryption. Without that privilege, a fully encrypted input returns EncryptedFile. A mixed input can return PartiallySuccessful: unencrypted sequences are converted, encrypted sequences are skipped, and the warning is reported through ErrorMessage.

For files encrypted with FileCryptingManager, decrypt the .gek file first with FileCryptingManager, then pass the decrypted .g64 file to the ASF or MP4 converter.

Do not confuse file-level .gek encryption with G64x password protection. G64xPasswordProtectionConverter creates a password-protected .g64x output. It is not an ASF or MP4 decryption step, and the ASF and MP4 converters do not accept a G64x password.

Output files

outputFilePath supplies the output directory and base file name. The converter chooses the final extension for the target format. It does not overwrite an existing output path; when the target name already exists, it appends _1, _2, and so on.

ASF and MP4 conversion can produce more than one media file. This happens when a G64x contains multiple camera collections, when MP4 output must be split because the video codec, resolution, or rotation changes, or when ASF output must be split because the video resolution, audio rendering parameters, or video time gap changes the writer state. When ASF or MP4 conversion produces more than one media file, the converter also writes an .asx playlist and includes it in Filenames.

G64xPasswordProtectionConverter produces a single password-protected .g64x output file.

Cancelling a conversion

CancelConversion(bool deleteConversionFile) requests cancellation of the active conversion. The request is cooperative, so the conversion stops when the converter next observes the cancellation.

The deleteConversionFile argument has no effect. Do not rely on it to keep or delete a partial output file.

When a conversion ends with a result other than Successful or PartiallySuccessful, the conversion engine attempts to delete output files that it registered during conversion. Cleanup is best effort; the converter can leave partial files behind if deletion fails.

After cancellation, ConvertAsync still completes and ConversionFinished is raised with Result == ConversionResult.Cancelled. Handle cancellation in the same event path as other results.

G64ToAsfConverter

using Genetec.Sdk.Media.Export;

AsfProfile profile = G64ToAsfConverter.GetAsfProfiles()[0];

using G64ToAsfConverter asfConverter = new G64ToAsfConverter();

asfConverter.ProgressChanged += OnConversionProgressChanged;
asfConverter.ConversionFinished += OnConversionFinished;

asfConverter.Initialize(
    engine,
    inputFilePath,
    displayDateTime: true,
    writeCameraName: true,
    exportAudio: true,
    outputFilePath: outputFilePath,
    profileId: profile.Profile);

await asfConverter.ConvertAsync();

GetAsfProfiles() returns ASF profiles discovered from the local Windows Media profile manager. The list contains profiles that support both video and audio streams. The converter caches the list after the first call. Use the Profile GUID from one of the returned AsfProfile values as profileId.

If the local system returns no ASF profiles, the returned list is empty. Do not start ASF conversion in that case; pick a Profile GUID from a non-empty GetAsfProfiles() result.

ASF options

Option Effect
displayDateTime Burns the frame timestamp into the ASF video at the top-left corner. The timestamp is converted with the time zone stored in the G64 header; if that time zone cannot be resolved, the converter falls back to the local system time zone.
writeCameraName Burns the encoder name from the G64 header into the ASF video near the bottom-left corner.
exportAudio Adds audio when the input contains audio in the requested range. If audio is missing or sparse, conversion can still continue without an audio source.
profileId Selects the Windows Media ASF profile used to encode the ASF file.

Date/time and camera name are written into the video pixels. They are not separate metadata that can be hidden later.

ASF conversion decodes the input video and writes ASF samples. Standard overlay streams recorded with the video are rendered into the output. Overlay data that ASF conversion does not support is removed and reported as partial success.

G64ToMp4Converter

using Genetec.Sdk.Media.Export;

using G64ToMp4Converter mp4Converter = new G64ToMp4Converter();

mp4Converter.ProgressChanged += OnConversionProgressChanged;
mp4Converter.ConversionFinished += OnConversionFinished;

mp4Converter.Initialize(
    engine,
    inputFilePath,
    exportAudio: true,
    outputFilePath: outputFilePath);

await mp4Converter.ConvertAsync();

G64ToMp4Converter.Initialize has only exportAudio as an MP4 option. It does not have ASF-style date/time burn-in, camera-name burn-in, ASF profile selection, or timestamp-subtitle options.

MP4 options

Option Effect
exportAudio Adds audio when the input contains audio and the audio codec can be written to MP4.

MP4 codecs, audio, and partial success

MP4 video supports H.264, MPEG-4, HEVC, AV1, and MJPEG by default.

MP4 audio supports AAC. If exportAudio is true but the audio codec is not supported for MP4, the converter drops the audio and reports PartiallySuccessful instead of failing the entire conversion.

When the video cannot be written or transcoded to an MP4-supported codec, the result is CodecNotSupported.

MP4 conversion can also return PartiallySuccessful when it removes overlay streams, skips encrypted sequences, encounters frame-format warnings, finds frames going back in time, or drops H.264 frames with missing slice data.

MP4 metadata

MP4 conversion produces MP4 media files, not a G64x package. The MP4 writer receives the first G64 header and stores it in a Genetec-specific MP4 box. It also writes standard Windows/iTunes-style metadata from that header for media-player display. Treat the Genetec header box as the Security Center metadata carrier; do not rely on standard MP4 metadata for all G64 or G64x semantics.

The MP4 output does not preserve the full G64x package behavior. Do not use MP4 when the recipient needs the original export package, password protection, encryption keys, all package streams, or Security Center-specific playback behavior.

G64xPasswordProtectionConverter

using Genetec.Sdk.Media.Export;

using G64xPasswordProtectionConverter passwordConverter =
    new G64xPasswordProtectionConverter();

passwordConverter.ProgressChanged += OnConversionProgressChanged;
passwordConverter.ConversionFinished += OnConversionFinished;

passwordConverter.Initialize(
    inputFilePath,
    outputFilePath,
    password);

await passwordConverter.ConvertAsync();

This converter keeps the file format as G64x and adds password protection. Use it for controlled sharing of G64x packages. The output remains a Security Center export package; the password controls access to playback.

G64xPasswordProtectionConverter.Initialize does not have an Engine parameter. It validates the input path, output path, and password before conversion starts.

The converter always writes .g64x, even when the input is .g64. It uses the output path only for the directory and base file name.

Because the SDK converter does not expose an Engine overload, it cannot use the logged-on user's Security Center privileges to remove existing Security Center encryption. If a G64x input already contains encrypted media and the converter cannot remove that encryption, conversion returns EncryptedFile.

See also

Platform SDK

Plugin SDK

Workspace SDK

Media SDK

Macro SDK

Web SDK

Synergis RIO

Media Gateway

Genetec Web Player

Clone this wiki locally