( videoUrl: string, outputPath: string, )
| 203 | } |
| 204 | |
| 205 | async function convertRemoteVideoToMp4FileInternal( |
| 206 | videoUrl: string, |
| 207 | outputPath: string, |
| 208 | ): Promise<void> { |
| 209 | try { |
| 210 | await runFfmpeg([ |
| 211 | "-y", |
| 212 | "-i", |
| 213 | videoUrl, |
| 214 | "-c", |
| 215 | "copy", |
| 216 | "-movflags", |
| 217 | "+faststart", |
| 218 | outputPath, |
| 219 | ]); |
| 220 | } catch { |
| 221 | await runFfmpeg([ |
| 222 | "-y", |
| 223 | "-i", |
| 224 | videoUrl, |
| 225 | "-c:v", |
| 226 | "libx264", |
| 227 | "-preset", |
| 228 | "veryfast", |
| 229 | "-pix_fmt", |
| 230 | "yuv420p", |
| 231 | "-c:a", |
| 232 | "aac", |
| 233 | "-b:a", |
| 234 | "128k", |
| 235 | "-movflags", |
| 236 | "+faststart", |
| 237 | outputPath, |
| 238 | ]); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | export async function convertRemoteVideoToMp4( |
| 243 | videoUrl: string, |
no test coverage detected