@@ -204,6 +204,38 @@ const convertToAv1 = (options: ConvertOptions) => convert(options.outputPath, {
204
204
options . outputPath
205
205
) ) ;
206
206
207
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
208
+ const convertToHevc = ( options : ConvertOptions ) => convert ( options . outputPath , {
209
+ onProgress : ( progress , estimate ) => {
210
+ options . onProgress ( 'Converting' , progress , estimate ) ;
211
+ } ,
212
+ startTime : options . startTime ,
213
+ endTime : options . endTime
214
+ } , conditionalArgs (
215
+ '-i' , options . inputPath ,
216
+ '-r' , options . fps . toString ( ) ,
217
+ '-c:v' , 'libx265' ,
218
+ '-c:a' , 'libopus' ,
219
+ '-preset' , 'medium' ,
220
+ '-tag:v' , 'hvc1' , // Metadata for macOS
221
+ {
222
+ args : [ '-an' ] ,
223
+ if : options . shouldMute
224
+ } ,
225
+ {
226
+ args : [
227
+ '-s' ,
228
+ `${ makeEven ( options . width ) } x${ makeEven ( options . height ) } ` ,
229
+ '-ss' ,
230
+ options . startTime . toString ( ) ,
231
+ '-to' ,
232
+ options . endTime . toString ( )
233
+ ] ,
234
+ if : options . shouldCrop || ! areDimensionsEven ( options )
235
+ } ,
236
+ options . outputPath
237
+ ) ) ;
238
+
207
239
// eslint-disable-next-line @typescript-eslint/promise-function-async
208
240
const convertToApng = ( options : ConvertOptions ) => convert ( options . outputPath , {
209
241
onProgress : ( progress , estimate ) => {
@@ -250,6 +282,7 @@ export const crop = (options: ConvertOptions) => convert(options.outputPath, {
250
282
export default new Map ( [
251
283
[ Format . gif , convertToGif ] ,
252
284
[ Format . mp4 , convertToMp4 ] ,
285
+ [ Format . hevc , convertToHevc ] ,
253
286
[ Format . webm , convertToWebm ] ,
254
287
[ Format . apng , convertToApng ] ,
255
288
[ Format . av1 , convertToAv1 ]
0 commit comments