# danog\MadelineProto\RecordingFormat: Container format of a call recording, as passed to {@see Call::setOutput()} and {@see Call::setOutputFolder()}.

> 
{@see self::Webm} and {@see self::Mkv} both mux the incoming audio and video into a Matroska
file in pure PHP (the peer's frames are stored as-is, so the video track is whatever codec the
peer sends — VP8/VP9/H.264/AV1 — and the audio is OPUS); they differ only in the declared EBML
DocType. {@see self::Opus} keeps the audio-only behaviour, writing an OGG OPUS stream.

When no format is passed to {@see Call::setOutput()}, it is autodetected from the extension of the
target — but only if a {@see LocalFile} was given; a raw stream, whose extension is unknown,
defaults to {@see self::Webm}. A {@see Call::setOutputFolder()} recording defaults to {@see self::Mkv}.


[Back to index](../../index.html)

> Author: Daniil Gentili <daniil@daniil.it>  
  

Container format of a call recording, as passed to {@see Call::setOutput()} and {@see Call::setOutputFolder()}.  


{@see self::Webm} and {@see self::Mkv} both mux the incoming audio and video into a Matroska
file in pure PHP (the peer's frames are stored as-is, so the video track is whatever codec the
peer sends — VP8/VP9/H.264/AV1 — and the audio is OPUS); they differ only in the declared EBML
DocType. {@see self::Opus} keeps the audio-only behaviour, writing an OGG OPUS stream.

When no format is passed to {@see Call::setOutput()}, it is autodetected from the extension of the
target — but only if a {@see LocalFile} was given; a raw stream, whose extension is unknown,
defaults to {@see self::Webm}. A {@see Call::setOutputFolder()} recording defaults to {@see self::Mkv}.



## Constants
* `danog\MadelineProto\RecordingFormat::Webm`: Matroska container with the `webm` DocType.

* `danog\MadelineProto\RecordingFormat::Mkv`: Matroska container with the `matroska` DocType.

* `danog\MadelineProto\RecordingFormat::Opus`: OGG OPUS audio-only stream.

## Properties
* `$name`: `string` 

## Method list:
* [`fromFile(\danog\MadelineProto\LocalFile $file): \danog\MadelineProto\RecordingFormat`](#fromFile)
* [`matroskaFor(\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream $file, ?\danog\MadelineProto\RecordingFormat $format): \danog\MadelineProto\RecordingFormat`](#matroskaFor)
* [`isMatroska(): bool`](#isMatroska)
* [`docType(): string`](#docType)
* [`cases(): array`](#cases)

## Methods:
### <a name="fromFile"></a> `fromFile(\danog\MadelineProto\LocalFile $file): \danog\MadelineProto\RecordingFormat`

Autodetect the recording format from a file's extension: `.mkv` and `.webm` map to the
matching Matroska format, and anything else (including an unknown extension) to {@see self::Opus}.  


Parameters:

* `$file`: `\danog\MadelineProto\LocalFile`   


#### See also: 
* [`\danog\MadelineProto\LocalFile`: Indicates a local file to upload.](../../danog/MadelineProto/LocalFile.html)




### <a name="matroskaFor"></a> `matroskaFor(\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream $file, ?\danog\MadelineProto\RecordingFormat $format): \danog\MadelineProto\RecordingFormat`

Resolve the format of a multi-party call recording, which is always Matroska: the given one, or
else {@see self::Webm} for a `.webm` {@see LocalFile} and {@see self::Mkv} for anything else.  


Parameters:

* `$file`: `\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream`   
* `$format`: `?\danog\MadelineProto\RecordingFormat`   


#### See also: 
* [`\danog\MadelineProto\LocalFile`: Indicates a local file to upload.](../../danog/MadelineProto/LocalFile.html)
* `\Amp\ByteStream\WritableStream`




### <a name="isMatroska"></a> `isMatroska(): bool`

Whether this format muxes video (and audio) into a Matroska container, rather than audio-only OGG.



### <a name="docType"></a> `docType(): string`

The EBML DocType to declare in the Matroska header for this format.



### <a name="cases"></a> `cases(): array`





---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
