Repository navigation
media sdk 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.
Every converter follows the same five steps:
- Construct the converter.
- Subscribe to
ConversionFinishedand, if the UI needs progress,ProgressChanged. - Call
Initializewith the input path, output path, and format-specific options. -
await ConvertAsync(). - Read the result from the
ConversionFinishedEventArgscarried by theConversionFinishedevent.
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.
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.
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.
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.
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.
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.
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.
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.
| 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.
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.
| Option | Effect |
|---|---|
exportAudio |
Adds audio when the input contains audio and the audio codec can be written to MP4. |
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 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.
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.
- About media file formats: Choosing between G64x, G64, and MP4 output.
- About MediaFile: Inspecting an existing G64, G64x, or MP4 file on disk.
- About MediaExporter: Producing G64 and G64x export packages from Security Center recordings.
- About FileCryptingManager: Encrypting and decrypting local media files.
- Overview
- Connecting to Security Center
- SDK certificates
- Referencing SDK assemblies
- ASP.NET hosting
- SDK compatibility
- Migrating to modern .NET
- Entities
- Entity cache
- Entity loading, cache, and query options
- Detecting entity changes
- Entity change event reference
- Transactions
- Security Center events
- Actions
- Security Desk
- Custom events
- Event-to-actions
- Managing macros
- ReportManager
- ReportManager query reference
- Access control raw events
- DownloadAllRelatedData and StrictResults
- Privileges
- Partitions
- Entity write restrictions
- About custom fields
- About video
- About cameras
- Enrolling a video unit
- Ingesting third-party video
- Archiver and auxiliary archiver roles
- Archive transfer
- About access control
- About cardholders and credentials
- About doors, areas, elevators, and access points
- About access rules and schedules
- About access control units and interface modules
- Enrolling an access control unit
- Door templates
- Visitors
- Mobile credentials
- About threat levels
- About alarms
- About incidents
- Maps
- Logging
- Overview
- Localization
- Certificates
- Lifecycle
- Threading
- State management
- Configuration
- Restricted configuration
- Events
- Queries
- Request manager
- Database
- Entity ownership
- Engine extensions
- Entity mappings
- Server management
- Custom privileges
- Custom entity types
- Resolving non-SDK assemblies
- Deploying plugins
- Modern .NET support
- Overview
- Localization
- Certificates
- Creating modules
- Tasks
- Pages
- Components
- Tile extensions
- Services
- Contextual actions
- Custom actions
- Options extensions
- Configuration pages
- Monitors
- Shared components
- Commands
- Extending events
- Map extensions
- Timeline providers
- Image extractors
- Credential encoders
- Credential readers
- Cardholder fields extractors
- Badge printers
- Content builders
- Dashboard widgets
- Incidents
- Logon providers
- Pinnable content builders
- Custom report pages
- Overview
- Getting started
- Media file formats
- MediaPlayer
- VideoSourceFilter
- MediaExporter
- MediaFile
- G64 converters
- FileCryptingManager
- PlaybackSequenceQuerier
- PlaybackStreamReader
- OverlayFactory
- PtzCoordinatesManager
- AudioTransmitter
- AudioRecorder
- AnalogMonitorController
- Camera blocking
- Overview
- Getting started
- Referencing entities
- Entity operations
- About access control in the Web SDK
- About video in the Web SDK
- Users and user groups
- Partitions
- Custom fields
- Custom card formats
- Actions
- Events and alarms
- Incidents
- Reports
- Tasks
- Macros
- Custom entity types
- System endpoints
- Performance guide
- Reference
- Endpoints
- Constants
- Enumerations
- Under the hood
- Troubleshooting