(ffprobePath, p)
| 29 | } |
| 30 | |
| 31 | export async function readVideoFileInfo(ffprobePath, p) { |
| 32 | const streams = await readFileStreams(ffprobePath, p); |
| 33 | const stream = streams.find((s) => s.codec_type === 'video'); // TODO |
| 34 | |
| 35 | const duration = await readDuration(ffprobePath, p); |
| 36 | |
| 37 | let rotation = parseInt(stream.tags && stream.tags.rotate, 10); |
| 38 | |
| 39 | // If we can't find rotation, try side_data_list |
| 40 | if (Number.isNaN(rotation) && Array.isArray(stream.side_data_list) && stream.side_data_list[0] && stream.side_data_list[0].rotation) { |
| 41 | rotation = parseInt(stream.side_data_list[0].rotation, 10); |
| 42 | } |
| 43 | |
| 44 | return { |
| 45 | // numFrames: parseInt(stream.nb_frames, 10), |
| 46 | duration, |
| 47 | width: stream.width, // TODO coded_width? |
| 48 | height: stream.height, |
| 49 | framerateStr: stream.r_frame_rate, |
| 50 | rotation: !Number.isNaN(rotation) ? rotation : undefined, |
| 51 | }; |
| 52 | } |
| 53 | |
| 54 | export async function readAudioFileInfo(ffprobePath, p) { |
| 55 | const duration = await readDuration(ffprobePath, p); |
no test coverage detected