UNPKG

@remotion/media-parser

Version:

A pure JavaScript library for parsing video files

56 lines (55 loc) 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getVideoCodecFromIsoTrak = void 0; const traversal_1 = require("./traversal"); const getVideoCodecFromIsoTrak = (trakBox) => { const stsdBox = (0, traversal_1.getStsdBox)(trakBox); if (stsdBox && stsdBox.type === 'stsd-box') { const videoSample = stsdBox.samples.find((s) => s.type === 'video'); if (videoSample && videoSample.type === 'video') { if (videoSample.format === 'hvc1' || videoSample.format === 'hev1') { return 'h265'; } if (videoSample.format === 'avc1') { return 'h264'; } if (videoSample.format === 'av01') { return 'av1'; } // ap4h: ProRes 4444 if (videoSample.format === 'ap4h') { return 'prores'; } // ap4x: ap4x: ProRes 4444 XQ if (videoSample.format === 'ap4x') { return 'prores'; } // apch: ProRes 422 High Quality if (videoSample.format === 'apch') { return 'prores'; } // apcn: ProRes 422 Standard Definition if (videoSample.format === 'apcn') { return 'prores'; } // apcs: ProRes 422 LT if (videoSample.format === 'apcs') { return 'prores'; } // apco: ProRes 422 Proxy if (videoSample.format === 'apco') { return 'prores'; } // aprh: ProRes RAW High Quality if (videoSample.format === 'aprh') { return 'prores'; } // aprn: ProRes RAW Standard Definition if (videoSample.format === 'aprn') { return 'prores'; } } } throw new Error('Could not find video codec'); }; exports.getVideoCodecFromIsoTrak = getVideoCodecFromIsoTrak;