Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

FFmpegConversion class: Difference between revisions

From Catglobe Wiki
Created page with "{{CGscriptClass_Template |Name=<nowiki>FFmpegConversion</nowiki> |Description=<nowiki>Glue class to call FFmpeg library to convert media</nowiki> |Constructors= {{CGscriptCons..."
 
No edit summary
Line 19: Line 19:
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
}}
}}
=== <span style="color:#DF8621">'''Examples'''</span> ===
<span style="color:#DF8621"> Create a new translatable text </span>
<source lang="javascript">
Attachment attachment = new Attachment (5224744);
FFmpegConversion conv = new FFmpegConversion(attachment);
conv.SetAudioConversionToMp3(0, 5);
conv.Convert();
//Noted that: after converting will overwrite the source media file, so better, should name the source file with .mp3
//Result: the attachment will be updated, the file size will be down
</source>

Revision as of 04:30, 19 February 2020

FFmpegConversion



Glue class to call FFmpeg library to convert media

Constructors

  • (Attachment attachment "Attachment to convert") - Convert existing file
  • (string filename "Name of the file", bool isTemp "Is the file temporary") - Convert existing file

Methods

  • number Convert() - Start the conversion process, return number of seconds it took
  • Empty SetAudioConversionToMp3(int nth "Pick the nth audiostream in the source", int compression "Level of compression from 0 to 9, with 9 being worst quality. see https://trac.ffmpeg.org/wiki/Encode/MP3") - Convert the source audio stream to MP3 format. If the source is already mp3. If already mp3 and similar or lower quality in source no further loss is done
  • string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

Create a new translatable text

Attachment attachment = new Attachment (5224744);
FFmpegConversion conv = new FFmpegConversion(attachment);
conv.SetAudioConversionToMp3(0, 5);
conv.Convert();
//Noted that: after converting will overwrite the source media file, so better, should name the source file with .mp3
//Result: the attachment will be updated, the file size will be down